1

I'm working in a huge swift project. I'm testing DeviceKit pod from cocoapods, and worked perfectly until today. Even yesterday worked perfectly.

Now, suddenly I can't compile because that class is giving me these kind of errors:

Device.generated.swift:49:8: Type Body Length Violation: Type body should span 300 lines or less excluding comments and whitespace: currently spans 447 lines (type_body_length)

Device.generated.swift:220:10: Identifier Name Violation: Enum element name should only contain alphanumeric characters: 'appleWatchSeries0_42mm' (identifier_name)

Device.generated.swift:1150:1: File Line Length Violation: File should contain 400 lines or less: currently contains 1150 (file_length)

It's this class from this project: https://github.com/devicekit/DeviceKit/blob/master/Source/Device.generated.swift

I didn't touch the class, It's a class inside a pod, so I can't understand why yesterday it was compiling perfectly and now it doesn't compile. How is that possible?

I have this version of SwiftLint in my cocoapods pod file:

pod 'SwiftLint', '<= 0.20.1' # SwiftLint, para limpieza de código

I tried updating it to last version, but the problem persists.

This is my .SwiftLint.yml file, as you can see is ignoring pods:

disabled_rules: # rule identifiers to exclude from running
#  - colon
#  - comma
  - control_statement
  - vertical_whitespace
  - trailing_whitespace
  - discarded_notification_center_observer
opt_in_rules: # some rules are only opt-in
  - explicit_init
  - fatal_error_message
  - first_where
  - multiline_parameters
  - operator_usage_whitespace
  - private_outlet
  - cyclomatic_complexity
included: # paths to include during linting. `--path` is ignored if present.
excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Pods

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
  severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
function_body_length:
  warning: 50
  error: 200
line_length: 
  warning: 200
  error: 300
  ignores_function_declarations: true
  ignores_comments: true
identifier_name:
  min_length:
    warning: 3
  excluded:
    - id
    - to
    - db
    - ad
# they can set both implicitly with an array
type_body_length:
  - 300 # warning
  - 400 # error
# or they can set both explicitly
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
halfer
  • 19,824
  • 17
  • 99
  • 186
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
  • Did you podfile.lock with the version of Swiftlint change? Did the structure of your project change? Are you sure it's reading correctly your swiftlint.yml ? (for instance, if you force an error on `line_length` in your own code, is it seen? If you change the parameters too? – Larme Dec 01 '20 at 13:35
  • Did you change the Xcode version: https://github.com/realm/SwiftLint/issues/3449 ? If yes, what's the script that launch it? `"${PODS_ROOT}/SwiftLint/swiftlint"`? – Larme Dec 01 '20 at 13:37
  • 1
    Obviously something did change since yesterday, even though you say it didn't. Do a `git diff` with a yesterday commit to find out what changed. – matt Dec 01 '20 at 15:12
  • @Larme it's reading swiftLint is working, if I put a line error of 1, gives hundreds of errors. Nothing has changed in my project. Maybe a silent update of xcode? don't know – NullPointerException Dec 02 '20 at 19:11
  • @Larme I'm using xcode 12.1, maybe it has been updated, yes, I remember to accept to install xcode tools some days ago. Maybe thats the cause? how can I check that script? that file you are telling the route is a binary – NullPointerException Dec 02 '20 at 19:14
  • @matt nothing has changed, maybe a xcode update – NullPointerException Dec 02 '20 at 19:14
  • omg @Larme after cloning again the project and executing it again (exactly same revision and all the same) xcode is launching it successfully. How is that possible? – NullPointerException Dec 02 '20 at 19:47
  • `git diff` on the current code? I don't know. Some cache issue? – Larme Dec 02 '20 at 19:48

0 Answers0