Skip to content

Instantly share code, notes, and snippets.

@uhooi
Created May 19, 2020 01:53
Show Gist options
  • Select an option

  • Save uhooi/6006b56c897d5059f1af8d9e1d853862 to your computer and use it in GitHub Desktop.

Select an option

Save uhooi/6006b56c897d5059f1af8d9e1d853862 to your computer and use it in GitHub Desktop.
たなのなかさんにSwiftLintの設定を教えるためだけのGist。更新しない。
# デフォルト有効で無効にするルール
disabled_rules:
#- block_based_kvo
#- class_delegate_protocol
#- closing_brace
#- closure_parameter_position
#- colon
#- comma
#- compiler_protocol_init
#- control_statement
#- custom_rules
#- cyclomatic_complexity
#- deployment_target
#- discarded_notification_center_observer
#- discouraged_direct_init
#- duplicate_enum_cases
#- duplicate_imports
#- dynamic_inline
#- empty_enum_arguments
#- empty_parameters
#- empty_parentheses_with_trailing_closure
#- file_length
#- for_where
#- force_cast
#- force_try
#- function_body_length
#- function_parameter_count
#- generic_type_name
#- identifier_name
#- implicit_getter
#- inert_defer
#- is_disjoint
#- large_tuple
#- leading_whitespace
#- legacy_cggeometry_functions
#- legacy_constant
#- legacy_constructor
#- legacy_hashing
#- legacy_nsgeometry_functions
#- line_length
#- mark
#- multiple_closures_with_trailing_closure
#- nesting
#- no_fallthrough_only
#- no_space_in_method_call
#- notification_center_detachment
#- nsobject_prefer_isequal
#- opening_brace
#- operator_whitespace
#- private_over_fileprivate
#- private_unit_test
#- protocol_property_accessors_order
#- reduce_boolean
#- redundant_discardable_let
#- redundant_objc_attribute
#- redundant_optional_initialization
#- redundant_set_access_control
#- redundant_string_enum_value
#- redundant_void_return
#- return_arrow_whitespace
#- shorthand_operator
#- statement_position
#- superfluous_disable_command
#- switch_case_alignment
#- syntactic_sugar
#- todo
#- trailing_comma
#- trailing_newline
#- trailing_semicolon
#- trailing_whitespace
#- type_body_length
#- type_name
#- unneeded_break_in_switch
#- unused_capture_list
#- unused_closure_parameter
#- unused_control_flow_label
#- unused_enumerated
#- unused_optional_binding
#- unused_setter_value
#- valid_ibinspectable
#- vertical_parameter_alignment
#- vertical_whitespace
#- void_return
#- weak_computed_property
#- weak_delegate
#- xctfail_message
# デフォルト無効で有効にするルール
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_body_length
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- convenience_type
#- discouraged_object_literal # オブジェクトリテラルを使いたいため
- discouraged_optional_boolean
- discouraged_optional_collection
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
#- expiring_todo # TODOコメントに有効期限を書かないため
#- explicit_acl # できる限りACLを省略したいため
#- explicit_enum_raw_value # ローバリューを省略することもあるため
- explicit_init
#- explicit_self # 関数は `self.` を付けずに呼び出したいため
#- explicit_top_level_acl # できる限りACLを省略したいため
#- explicit_type_interface # できる限り型推論したいため
#- extension_access_modifier # このルールの意味を理解していないため
- fallthrough
- fatal_error_message
#- file_header # このルールの意味を理解していないため
- file_name
- file_types_order
- first_where
- flatmap_over_map_reduce
- force_unwrapping
- function_default_parameter_at_end
- identical_operands
- implicit_return
#- implicitly_unwrapped_optional # VIPERで変数を `!` で定義したいため
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
#- let_var_whitespace # 空白行を設けたくないこともあるため
- literal_expression_end_indentation
- lower_acl_than_parent
- missing_docs
- modifier_order
#- multiline_arguments # 引数は同じ行に2つ入れたいこともあるため
#- multiline_arguments_brackets # 括弧で行を増やしたくないため
#- multiline_function_chains # 関数の呼び出しは同じ行に2つ入れたいこともあるため
#- multiline_literal_brackets # 括弧で行を増やしたくないため
#- multiline_parameters # 引数は同じ行に2つ入れたいこともあるため
#- multiline_parameters_brackets # 括弧で行を増やしたくないため
- nimble_operator
#- no_extension_access_modifier # エクステンションにACLを設定したいことがあるため
#- no_grouping_extension
- nslocalizedstring_key
- nslocalizedstring_require_bundle
#- number_separator # 数字を `_` で区切りたくないため
#- object_literal # リテラルで生成したくないこともあるため
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
#- prefixed_toplevel_constant # 定数のプリフィックスに `k` を付けたくないため
- private_action
- private_outlet
#- prohibited_interface_builder # ストーリーボードを使ってビューを生成したいため
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- raw_value_for_camel_cased_codable_enum
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
#- required_deinit # できる限りデイニシャライザを省略したいため
- required_enum_case
- single_test_class
- sorted_first_last
#- sorted_imports # インポート文をアルファベット順以外に並び替えたいこともあるため
- static_operator
- strict_fileprivate
#- strong_iboutlet # `@IBOutlet` を `weak` で定義したいこともあるため
- switch_case_on_newline
- toggle_bool
- trailing_closure
- type_contents_order
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- unused_declaration
- unused_import
- vertical_parameter_alignment_on_call
#- vertical_whitespace_between_cases # Switch文のケース間に空白行を設けたくないこともあるため
#- vertical_whitespace_closing_braces # 中括弧を閉じる前に空白行を設けたいことがあるため
#- vertical_whitespace_opening_braces # 中括弧を開く前に空白行を設けたいことがあるため
- xct_specific_matcher
- yoda_condition
# 対象のファイル・フォルダ
# デフォルトからフォルダ名を変更していない場合、プロジェクト名と同名のフォルダを指定すればいい
included:
- UhooiPicBook
# 対象外のファイル・フォルダ
excluded:
- Pods
- UhooiPicBook/Generated
line_length:
warning: 300
error: 500
identifier_name:
min_length:
warning: 1 # `r` `g` `b` などを使いたいため
custom_rules:
pirates_beat_ninjas: # rule identifier
included: ".*\\.swift" # regex that defines paths to include during linting. optional.
excluded: ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
name: "Pirates Beat Ninjas" # rule name. optional.
regex: "([n,N]inja)" # matching pattern
capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
match_kinds: # SyntaxKinds to match. optional.
- comment
- identifier
message: "Pirates are better than ninjas." # violation message. optional.
severity: error # violation severity. optional.
no_hiding_in_strings:
regex: "([n,N]inja)"
match_kinds: string
@uhooi
Copy link
Copy Markdown
Author

uhooi commented May 19, 2020

ちなみにSwiftLintのバージョンは 0.39.1 です!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment