surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
The check can't read such a file, so it can't tell whether it sets a permission mode.
| @@ -153,14 +153,21 @@ | ||
| 153 | 153 | if arg.startswith("--settings=") |
| 154 | 154 | ] |
| 155 | 155 | for where, value in settings: |
| 156 | - if "defaultMode" in settings_text(value): | |
| 156 | + text = settings_text(value) | |
| 157 | + if text is None: | |
| 158 | + return ( | |
| 159 | + f"{where} names a file outside the repository, which this check cannot read. " | |
| 160 | + "Use inline settings or a file inside the repository" | |
| 161 | + ) | |
| 162 | + if "defaultMode" in text: | |
| 157 | 163 | return f"remove 'defaultMode' from {where}: settings must not set a permission mode" |
| 158 | 164 | return None |
| 159 | 165 | |
| 160 | 166 | |
| 161 | -def settings_text(value) -> str: | |
| 167 | +def settings_text(value) -> str | None: | |
| 162 | 168 | """The settings JSON a 'settings' value stands for: the value itself, or the contents of |
| 163 | - the file it names when it is a path inside the repository.""" | |
| 169 | + the file it names when it is a path inside the repository. None when it names a path | |
| 170 | + outside the repository.""" | |
| 164 | 171 | text = str(value or "").strip() |
| 165 | 172 | if not text or text.startswith("{"): |
| 166 | 173 | return text |
| @@ -170,7 +177,7 @@ | ||
| 170 | 177 | resolved = path.resolve() |
| 171 | 178 | resolved.relative_to(root) |
| 172 | 179 | except (OSError, ValueError): |
| 173 | - return text | |
| 180 | + return None | |
| 174 | 181 | if resolved.is_file(): |
| 175 | 182 | return resolved.read_text(encoding="utf-8", errors="replace") |
| 176 | 183 | return text |