{"record":{"id":"8f6f983d5885bdf4","repo":"rubocop/rubocop","slug":"configuration-for-lint-syntax-cop-found-in-smart","errorCode":null,"errorMessage":"configuration for Lint/Syntax cop found in #{smart_loaded_path}\nIt's not possible to disable this cop.","messagePattern":"configuration for Lint/Syntax cop found in #(.+?)\nIt's not possible to disable this cop\\.","errorType":"exception","errorClass":"RuboCop::ValidationError","httpStatus":null,"severity":"error","filePath":"lib/rubocop/config_validator.rb","lineNumber":163,"sourceCode":"      if suggestions.any?\n        \"Did you mean `#{suggestions.join('`, `')}`?\"\n      else\n        # Department names can contain slashes, e.g. Chef/Correctness, but there's no support for\n        # the concept of higher level departments in RuboCop. It's a flat structure. So if the user\n        # tries to configure a \"top level department\", we hint that it's the bottom level\n        # departments that should be configured.\n        suggestions = departments.select { |department| department.start_with?(\"#{name}/\") }\n        \"#{name} is not a department. Use `#{suggestions.join('`, `')}`.\" if suggestions.any?\n      end\n    end\n\n    def validate_syntax_cop\n      syntax_config = @config['Lint/Syntax']\n      default_config = ConfigLoader.default_configuration['Lint/Syntax']\n\n      return unless syntax_config && default_config.merge(syntax_config) != default_config\n\n      raise ValidationError,\n            \"configuration for Lint/Syntax cop found in #{smart_loaded_path}\\n\" \\\n            'It\\'s not possible to disable this cop.'\n    end\n\n    def validate_new_cops_parameter\n      validate_all_cops_new_cops_parameter\n      validate_department_new_cops_parameters\n    end\n\n    def validate_all_cops_new_cops_parameter\n      new_cop_parameter = @config.for_all_cops['NewCops']\n      return if new_cop_parameter.nil? || NEW_COPS_VALUES.include?(new_cop_parameter)\n\n      message = \"invalid #{new_cop_parameter} for `NewCops` found in \" \\\n                \"#{smart_loaded_path}\\n\" \\\n                \"Valid choices are: #{NEW_COPS_VALUES.join(', ')}\"\n\n      raise ValidationError, message","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/rubocop/rubocop/blob/ea712edf2b1b14cb9b3f748bb1003a6141c95c5e/lib/rubocop/config_validator.rb#L145-L181","documentation":"`Lint/Syntax` is a built-in, always-on cop that reports parser errors; it has no tunable parameters and cannot be disabled. The validator merges your `Lint/Syntax` section with the default and raises `ValidationError` if the result differs in any way — even an `Enabled: false` or an `Exclude` list.","triggerScenarios":"Adding `Lint/Syntax: Enabled: false` to silence syntax errors; `Lint/Syntax: Exclude: [vendor/**]` to skip generated or vendored files; any key under `Lint/Syntax` at all besides the identical default.","commonSituations":"Repos with intentionally invalid Ruby snippets (documentation fixtures, test data) triggering syntax offenses; attempts to exclude generated code from parsing.","solutions":["Delete the `Lint/Syntax` section from the config — syntax checking cannot be turned off.","For files that must not be parsed at all, exclude them globally with `AllCops: Exclude` (the files are then never inspected).","If specific files legitimately contain non-Ruby content, give them a non-.rb extension or move them outside the include paths."],"exampleFix":"# before (.rubocop.yml)\nLint/Syntax:\n  Enabled: false\n\n# after — drop the section; if files must be skipped entirely:\nAllCops:\n  Exclude:\n    - 'fixtures/invalid.rb'","handlingStrategy":"validation","validationCode":"config = YAML.load_file('.rubocop.yml')\nif config.key?('Lint/Syntax')\n  abort 'Lint/Syntax is not configurable — remove the section; use AllCops: Exclude to skip files'\nend","typeGuard":null,"tryCatchPattern":"begin\n  RuboCop::CLI.new.run([])\nrescue RuboCop::ValidationError => e\n  raise unless e.message.include?('Lint/Syntax')\n  puts 'syntax checking is always on; remove the Lint/Syntax section'\n  exit 1\nend","preventionTips":["Never add keys under Lint/Syntax; it is a protected, always-on cop.","To keep broken snippets in-repo, exclude their paths via AllCops: Exclude or use non-Ruby extensions.","Assert in a config linting script that protected sections (Lint/Syntax) are absent."],"tags":["rubocop","configuration","lint-syntax","protected-config"],"backgroundTag":"protected-config-key","analyzedSha":"ea712edf2b1b14cb9b3f748bb1003a6141c95c5e","analyzedAt":"2026-08-21T16:16:18.930Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}