{"action":"created","issue":{"url":"https://api.github.com/repos/realm/SwiftLint/issues/949","repository_url":"https://api.github.com/repos/realm/SwiftLint","labels_url":"https://api.github.com/repos/realm/SwiftLint/issues/949/labels{/name}","comments_url":"https://api.github.com/repos/realm/SwiftLint/issues/949/comments","events_url":"https://api.github.com/repos/realm/SwiftLint/issues/949/events","html_url":"https://github.com/realm/SwiftLint/issues/949","id":194429353,"number":949,"title":"Lack of configuration file can lead to wall of output","user":{"login":"reidmain","id":535202,"avatar_url":"https://avatars.githubusercontent.com/u/535202?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmain","html_url":"https://github.com/reidmain","followers_url":"https://api.github.com/users/reidmain/followers","following_url":"https://api.github.com/users/reidmain/following{/other_user}","gists_url":"https://api.github.com/users/reidmain/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmain/subscriptions","organizations_url":"https://api.github.com/users/reidmain/orgs","repos_url":"https://api.github.com/users/reidmain/repos","events_url":"https://api.github.com/users/reidmain/events{/privacy}","received_events_url":"https://api.github.com/users/reidmain/received_events","type":"User","site_admin":false},"labels":[{"id":212343554,"url":"https://api.github.com/repos/realm/SwiftLint/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-08T19:57:33Z","updated_at":"2016-12-08T21:09:34Z","closed_at":null,"body":"I inherited a Xcode project that already had swiftlint integrated correctly. I wrote a number of custom rules in our `.swiftlint.yml` file and they immediately popped up in Xcode. All of those custom rules were configured to raise warnings so that they didn't block developers locally but would get caught on CI where we treated errors as warnings.\r\n\r\nWhat I noticed was that swiftlint wasn't getting run on our CI boxes and I couldn't (and actually still  can't) figure out why. We are using Fastlane to run our tests on CI so when I googled `Fastlane swiftlint` I immediately got kicked to https://docs.fastlane.tools/actions/#swiftlint and attempted to add the `swiftlint` action to my Fastfile.\r\n\r\nI added:\r\n```\r\nswiftlint(config_file: \"my_company/.swiftlint.yml\",\r\n              strict: true,\r\n              ignore_exit_status: false)\r\n```\r\n\r\nand I got the unexpected output of:\r\n\r\n```\r\n[11:45:21]: ▸ Linting 'AppDelegate.swift' (1/370)\r\n[11:45:21]: ▸ configuration error: 'conditional_binding_cascade' is not a valid rule identifier\r\n[11:45:21]: ▸ Valid rule identifiers:\r\n[11:45:21]: ▸ opening_brace\r\n[11:45:21]: ▸ empty_count\r\n[11:45:21]: ▸ colon\r\n[11:45:21]: ▸ type_name\r\n[11:45:21]: ▸ explicit_init\r\n[11:45:21]: ▸ trailing_semicolon\r\n[11:45:21]: ▸ nimble_operator\r\n[11:45:21]: ▸ force_unwrapping\r\n[11:45:21]: ▸ mark\r\n[11:45:21]: ▸ function_body_length\r\n[11:45:21]: ▸ variable_name\r\n[11:45:21]: ▸ vertical_whitespace\r\n[11:45:21]: ▸ operator_whitespace\r\n[11:45:21]: ▸ closure_spacing\r\n[11:45:21]: ▸ legacy_constant\r\n[11:45:21]: ▸ line_length\r\n[11:45:21]: ▸ return_arrow_whitespace\r\n[11:45:21]: ▸ private_unit_test\r\n[11:45:21]: ▸ conditional_returns_on_newline\r\n[11:45:21]: ▸ legacy_constructor\r\n[11:45:21]: ▸ weak_delegate\r\n[11:45:21]: ▸ valid_docs\r\n[11:45:21]: ▸ file_length\r\n[11:45:21]: ▸ valid_ibinspectable\r\n[11:45:21]: ▸ legacy_nsgeometry_functions\r\n[11:45:21]: ▸ trailing_newline\r\n[11:45:21]: ▸ custom_rules\r\n[11:45:21]: ▸ overridden_super_call\r\n[11:45:21]: ▸ comma\r\n[11:45:21]: ▸ force_cast\r\n[11:45:21]: ▸ private_outlet\r\n[11:45:21]: ▸ trailing_comma\r\n[11:45:21]: ▸ force_try\r\n[11:45:21]: ▸ nesting\r\n[11:45:21]: ▸ function_parameter_count\r\n[11:45:21]: ▸ control_statement\r\n[11:45:21]: ▸ redundant_nil_coalescing\r\n[11:45:21]: ▸ implicit_getter\r\n[11:45:21]: ▸ trailing_whitespace\r\n[11:45:21]: ▸ closing_brace\r\n[11:45:21]: ▸ statement_position\r\n[11:45:21]: ▸ type_body_length\r\n[11:45:21]: ▸ todo\r\n[11:45:21]: ▸ cyclomatic_complexity\r\n[11:45:21]: ▸ missing_docs\r\n[11:45:21]: ▸ switch_case_on_newline\r\n[11:45:21]: ▸ syntactic_sugar\r\n[11:45:21]: ▸ leading_whitespace\r\n[11:45:21]: ▸ legacy_cggeometry_functions\r\n[11:45:21]: ▸ Linting 'BankViewController.swift' (2/370)\r\n[11:45:21]: ▸ configuration error: 'conditional_binding_cascade' is not a valid rule identifier\r\n[11:45:21]: ▸ Valid rule identifiers:\r\n[11:45:21]: ▸ opening_brace\r\n[11:45:21]: ▸ empty_count\r\n[11:45:21]: ▸ colon\r\n[11:45:21]: ▸ type_name\r\n[11:45:21]: ▸ explicit_init\r\n[11:45:21]: ▸ trailing_semicolon\r\n[11:45:21]: ▸ nimble_operator\r\n[11:45:21]: ▸ force_unwrapping\r\n[11:45:21]: ▸ mark\r\n[11:45:21]: ▸ function_body_length\r\n[11:45:21]: ▸ variable_name\r\n[11:45:21]: ▸ vertical_whitespace\r\n[11:45:21]: ▸ operator_whitespace\r\n[11:45:21]: ▸ closure_spacing\r\n[11:45:21]: ▸ legacy_constant\r\n[11:45:21]: ▸ line_length\r\n[11:45:21]: ▸ return_arrow_whitespace\r\n[11:45:21]: ▸ private_unit_test\r\n[11:45:21]: ▸ conditional_returns_on_newline\r\n[11:45:21]: ▸ legacy_constructor\r\n[11:45:21]: ▸ weak_delegate\r\n[11:45:21]: ▸ valid_docs\r\n[11:45:21]: ▸ file_length\r\n[11:45:21]: ▸ valid_ibinspectable\r\n[11:45:21]: ▸ legacy_nsgeometry_functions\r\n[11:45:21]: ▸ trailing_newline\r\n[11:45:21]: ▸ custom_rules\r\n[11:45:21]: ▸ overridden_super_call\r\n[11:45:21]: ▸ comma\r\n[11:45:21]: ▸ force_cast\r\n[11:45:21]: ▸ private_outlet\r\n[11:45:21]: ▸ trailing_comma\r\n[11:45:21]: ▸ force_try\r\n[11:45:21]: ▸ nesting\r\n[11:45:21]: ▸ function_parameter_count\r\n[11:45:21]: ▸ control_statement\r\n[11:45:21]: ▸ redundant_nil_coalescing\r\n[11:45:21]: ▸ implicit_getter\r\n[11:45:21]: ▸ trailing_whitespace\r\n[11:45:21]: ▸ closing_brace\r\n[11:45:21]: ▸ statement_position\r\n[11:45:21]: ▸ type_body_length\r\n[11:45:21]: ▸ todo\r\n[11:45:21]: ▸ cyclomatic_complexity\r\n[11:45:21]: ▸ missing_docs\r\n[11:45:21]: ▸ switch_case_on_newline\r\n[11:45:21]: ▸ syntactic_sugar\r\n[11:45:21]: ▸ leading_whitespace\r\n[11:45:21]: ▸ legacy_cggeometry_functions\r\n```\r\n\r\nFor some reason the rules that were being used were being outputted for every file that was linted. With 370 files my console immediately became an unreadable mess.\r\n\r\nThe command that Fastlane was running was `swiftlint lint --strict --config my_company/.swiftlint.yml` and when I ran the command in the terminal I got the same output as above.\r\n\r\nHowever when I `cd my_company` and ran `swiftlint lint --strict --config .swiftlint.yml` I got what you would expect. The rules only printed out once and then each file being linted was listed.\r\n\r\n```\r\nLoading configuration from '.swiftlint.yml'\r\nconfiguration error: 'conditional_binding_cascade' is not a valid rule identifier\r\nValid rule identifiers:\r\nopening_brace\r\nempty_count\r\ncolon\r\ntype_name\r\nexplicit_init\r\ntrailing_semicolon\r\nnimble_operator\r\nforce_unwrapping\r\nmark\r\nfunction_body_length\r\nvariable_name\r\nvertical_whitespace\r\noperator_whitespace\r\nclosure_spacing\r\nlegacy_constant\r\nline_length\r\nreturn_arrow_whitespace\r\nprivate_unit_test\r\nconditional_returns_on_newline\r\nlegacy_constructor\r\nweak_delegate\r\nvalid_docs\r\nfile_length\r\nvalid_ibinspectable\r\nlegacy_nsgeometry_functions\r\ntrailing_newline\r\ncustom_rules\r\noverridden_super_call\r\ncomma\r\nforce_cast\r\nprivate_outlet\r\ntrailing_comma\r\nforce_try\r\nnesting\r\nfunction_parameter_count\r\ncontrol_statement\r\nredundant_nil_coalescing\r\nimplicit_getter\r\ntrailing_whitespace\r\nclosing_brace\r\nstatement_position\r\ntype_body_length\r\ntodo\r\ncyclomatic_complexity\r\nmissing_docs\r\nswitch_case_on_newline\r\nsyntactic_sugar\r\nleading_whitespace\r\nlegacy_cggeometry_functions\r\nLinting Swift files in current working directory\r\nLinting 'AppDelegate.swift' (1/298)\r\nLinting 'BankViewController.swift' (2/298)\r\nLinting 'BankSearchViewController.swift' (3/298)\r\n```\r\n\r\nI then went back to the original directory, ran just `swiftlint` and got the same issue as before where every file that was linted outputted the rules being used.\r\n\r\nIt looks like if swiftlint doesn't have a configuration file specified or if one does not exist in the same directory that swiftlint is being run from there is some issue that causes the rules to be outputted for every file which gunks up the console."},"comment":{"url":"https://api.github.com/repos/realm/SwiftLint/issues/comments/265856214","html_url":"https://github.com/realm/SwiftLint/issues/949#issuecomment-265856214","issue_url":"https://api.github.com/repos/realm/SwiftLint/issues/949","id":265856214,"user":{"login":"reidmain","id":535202,"avatar_url":"https://avatars.githubusercontent.com/u/535202?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmain","html_url":"https://github.com/reidmain","followers_url":"https://api.github.com/users/reidmain/followers","following_url":"https://api.github.com/users/reidmain/following{/other_user}","gists_url":"https://api.github.com/users/reidmain/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmain/subscriptions","organizations_url":"https://api.github.com/users/reidmain/orgs","repos_url":"https://api.github.com/users/reidmain/repos","events_url":"https://api.github.com/users/reidmain/events{/privacy}","received_events_url":"https://api.github.com/users/reidmain/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T21:09:34Z","updated_at":"2016-12-08T21:09:34Z","body":"Oh but I should mention that if I run `swiftlint` at the same level as the configuration file it still works.\r\n\r\nAlso this may be useful. If I just run `swiftlint` in the directory that fastlane would run it in I get\r\n\r\n```\r\nswiftlint\r\nLinting Swift files in current working directory\r\nLinting 'AppDelegate.swift' (1/370)\r\nfatal error: Could not read configuration file at path '/Users/reidmain/Development/Affirm/ios/affirm': Error Domain=NSCocoaErrorDomain Code=257 \"The file “affirm” couldn’t be opened because you don’t have permission to view it.\" UserInfo={NSFilePath=/Users/reidmain/Development/Affirm/ios/affirm, NSUnderlyingError=0x7fe6ec72f550 {Error Domain=NSPOSIXErrorDomain Code=13 \"Permission denied\"}}: file /Users/reidmain/Development/GitHub/SwiftLint/Source/SwiftLintFramework/Models/Configuration.swift, line 164\r\nIllegal instruction: 4\r\n```"}}
{"actor":{"display_login":"reidmain"}}