Skip to content

Instantly share code, notes, and snippets.

@mnaruse
Created June 14, 2020 10:45
Show Gist options
  • Save mnaruse/0b9721584d23919fd8448a2044a057f8 to your computer and use it in GitHub Desktop.
Save mnaruse/0b9721584d23919fd8448a2044a057f8 to your computer and use it in GitHub Desktop.
My favorite ".swiftlint.yml" file.
included:
- Practice_SwiftStyle
# - Source
# - Tests
# 対象外のファイル・フォルダ
excluded:
# - Tests/SwiftLintFrameworkTests/Resources
- Pods/
- Generated
- Carthage/
# デフォルト有効で無効にするルール
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_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
#- notification_center_detachment
#- opening_brace
#- operator_whitespace
#- private_over_fileprivate
#- private_unit_test
#- protocol_property_accessors_order
#- 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_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_first_not_nil
- convenience_type
#- discouraged_object_literal # オブジェクトリテラルを使いたいため
- discouraged_optional_boolean
- discouraged_optional_collection
- empty_count
- empty_string
- empty_xctest_method
#- 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
- first_where
- force_unwrapping
- function_default_parameter_at_end
- identical_operands
- implicit_return
#- implicitly_unwrapped_optional # VIPERで変数を `!` で定義したいため
- joined_default_parameter
- last_where
- 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
#- 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
- 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
- unavailable_function
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- unused_import
- unused_private_declaration
- vertical_parameter_alignment_on_call
#- vertical_whitespace_between_cases # Switch文のケース間に空白行を設けたくないこともあるため
#- vertical_whitespace_closing_braces # 中括弧を閉じる前に空白行を設けたいことがあるため
#- vertical_whitespace_opening_braces # 中括弧を開く前に空白行を設けたいことがあるため
- xct_specific_matcher
- yoda_condition
line_length:
warning: 300
error: 500
identifier_name:
min_length:
warning: 1 # `r` `g` `b` などを使いたいため
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment