lint.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Workaround to enable usage of mixed SSH and Docker GitLab CI runners
  2. .template_lint: &template_lint
  3. stage: lint
  4. extends:
  5. - .job_rules_default
  6. .template_lint_rails: &template_lint_rails
  7. extends:
  8. - .template_lint
  9. - .services_postgresql
  10. before_script:
  11. - !reference [.scripts, source_rvm]
  12. - !reference [.scripts, bundle_install]
  13. - !reference [.scripts, configure_environment]
  14. - !reference [.scripts, zammad_db_init]
  15. # Must be a separate job because it uses a custom image.
  16. 'lint: shellcheck':
  17. <<: *template_lint
  18. image: koalaman/shellcheck-alpine:stable
  19. cache: []
  20. before_script: []
  21. script:
  22. - shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | egrep -v "/vendor|node_modules/")
  23. - shellcheck -S error script/init.d/*
  24. after_script: []
  25. 'lint: i18n & rails':
  26. <<: *template_lint_rails
  27. cache: !reference [.cache, read_only_full]
  28. artifacts:
  29. expire_in: 1 week
  30. paths:
  31. - tmp/brakeman-report.html
  32. when: on_failure
  33. script:
  34. - !reference [.scripts, yarn_install]
  35. - echo "Checking .po file syntax..."
  36. - for FILE in i18n/*.pot i18n/*.po; do echo "Checking $FILE"; msgfmt -o /dev/null -c $FILE; done
  37. - echo "Checking .pot catalog consistency..."
  38. - bundle exec rails generate translation_catalog --check
  39. - echo "Brakeman security check..."
  40. - bundle exec brakeman -o /dev/stdout -o tmp/brakeman-report.html
  41. - echo "Rails zeitwerk:check autoloader check..."
  42. - bundle exec rails zeitwerk:check
  43. - .gitlab/check_graphql_api_consistency.sh
  44. 'lint: ruby & security':
  45. <<: *template_lint
  46. before_script:
  47. - !reference [.scripts, source_rvm]
  48. - !reference [.scripts, bundle_install]
  49. script:
  50. - echo "Rubocop check..."
  51. - bundle exec .rubocop/validate_todos.rb
  52. - bundle exec rubocop --parallel
  53. - echo "bundler-audit security check..."
  54. - gem install bundler-audit
  55. - bundle-audit update
  56. - bundle-audit --ignore CVE-2015-9284
  57. 'lint: js & css':
  58. <<: *template_lint
  59. cache: !reference [.cache, read_only_nodejs]
  60. before_script: []
  61. script:
  62. - echo "Coffeelint check..."
  63. - coffeelint --rules ./.coffeelint/rules/* app/
  64. - echo "Stylelint check..."
  65. - !reference [.scripts, yarn_install]
  66. - yarn lint:css
  67. - echo "ESLint check..."
  68. - yarn storybook:install
  69. - yarn lint
  70. - echo "Storybook test build..."
  71. - yarn storybook:build
  72. # Must be a separate job because it may fail and is only executed manually.
  73. 'lint: orphaned ruby gems':
  74. <<: *template_lint_rails
  75. allow_failure: true
  76. rules:
  77. - if: $CI_MERGE_REQUEST_ID
  78. when: never
  79. - when: manual
  80. script:
  81. - bundle exec rake zammad:ci:bundle:orphaned 5