개발/Swift

fastlane 에 swiftlint 추가하기

덤벨로퍼 2021. 4. 8. 11:24

swiftlint file 을 다음과같이 작성했다.

disabled_rules:
    - colon
    - comma
    - control_statement
    - trailing_whitespace
opt_in_rules:
    - missing_docs
included:
excluded:
    - Carthage
    - Pods
    

force_cast: warning

force_try:
  severity: warning
  
line_length: 200
type_body_length:
    - 300
    
trailing_whitespace : 1
identifier_name:
  allowed_symbols: "_"
  min_length: 3

shorthand_operator: warning

 

 

fastlane 과 연동하려한다.

Fastfile에 lint lane 을 추가한다.

  lane :lint do
    swiftlint(
      mode: :lint,
      executable: "Pods/SwiftLint/swiftlint",
      reporter: "html",
      output_file: "fastlane/swiftlint-results.html",
      config_file: '.swiftlint.yml',
      ignore_exit_status: true
    )
  end

이후 fastlane lint 를 실행하면  fastlane 폴더에 swiftlint-result.html 파일이 생긴다.

해당 파일에서는 결과값들을 볼수있다.