realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.69k stars 2.22k forks source link

Illegal instruction: 4 [Found reason, asking for message improvement] #3176

Closed danielaRiesgo closed 4 years ago

danielaRiesgo commented 4 years ago

New Issue Checklist

Describe the bug

I had the Illegal instruction 4 problem as many issues out there, but my cause was different from the ones I found and I think there could be a better message accompanying the output.

Complete output when running SwiftLint, including the stack trace and command used
$ ./Pods/SwiftLint/swiftlint lint
Loading configuration from '.swiftlint.yml'
Illegal instruction: 4

Environment

disabled_rules: # rule identifiers to exclude from running
  - void_return
  - vertical_whitespace
  - trailing_whitespace
  - trailing_newline
  - control_statement
  - trailing_semicolon
  - identifier_name
  - type_name
  - colon
  - line_length
  - unused_closure_parameter
  - unused_optional_binding
  - for_where
  - cyclomatic_complexity
  - function_body_length
  - file_length
  - redundant_optional_initialization
  - closure_parameter_position
  - force_cast
  - force_try
  - shorthand_operator
  - comma
  - discarded_notification_center_observer
  - opening_brace
  - redundant_void_return
  - vertical_parameter_alignment
  - nesting
  - syntactic_sugar
  - force_unwrapping
  - switch_case_alignment
  - empty_parentheses_with_trailing_closure
  - statement_position
  - return_arrow_whitespace
  - empty_enum_arguments
  - redundant_objc_attribute
  - legacy_constructor
  - mark
  - trailing_comma
  - unneeded_break_in_switch
  - function_parameter_count
  - type_body_length
  - leading_whitespace
  - class_delegate_protocol
  - weak_delegate
  - private_over_fileprivate
  - redundant_string_enum_value
  - operator_whitespace
  - reduce_boolean
  - compiler_protocol_init
  - closure_spacing
  - convenience_type
  - discouraged_optional_boolean
  - empty_count
  - empty_string
  - force_unwrapping
  - todo # This should stay as a warning, but since we are transforming warnings to errors we need to disable it for now.

opt_in_rules:
  - yoda_condition
  - closure_spacing
  - collection_alignment
  - contains_over_first_not_nil
  - convenience_type
  - discouraged_optional_boolean
  - empty_count
  - empty_string
  - fatal_error_message
  - first_where
  - force_unwrapping
  - identical_operands
  - quick_discouraged_focused_test
  - quick_discouraged_pending_test
  # Find all the available rules by running:
  # swiftlint rules

included: # paths to include during linting. `--path` is ignored if present.
  - podcast

excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Carthage
  - Pods

# opening_brace:
#   severity: error
# colon:
#   severity: error
# comma:
#   severity: error
# unused_optional_binding:
#   severity: error
# trailing_whitespace:
#   severity: error
# vertical_parameter_alignment:
#   severity: error
# trailing_newline:
#   severity: error
# void_return:
#   severity: error
identifier_name:
  # severity: error
  excluded:
    - nc
    - vc
    - vm
    - id
    - tc
    - URL

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)

Solution

I had a rule listed twich in the disabled_rules list. I had rules in the disabled_rules list and the opt_in rules list as well.

I removed all of them (commented them in fact) and Swiftlint started working.

Ideally, the message with which Swiftlint fails could be improved to say there are inconsistencies in the yml file.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!