Class: WayOfWorking::CodeLinting::Hdi::Generators::InitLinters
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- WayOfWorking::CodeLinting::Hdi::Generators::InitLinters
- Includes:
- Thor::Actions
- Defined in:
- lib/way_of_working/code_linting/hdi/generators/init_linters.rb
Overview
This generator initialises the linter
Constant Summary collapse
- LINTING_BUILD_PHASE =
" 2F0882F42AAB152D00DB0B2B /* ShellScript */,\n"
- LINTING_BUILD_PHASE_DETAILS =
<<~CONFIG /* Begin PBXShellScriptBuildPhase section */ \t\t2F0882F42AAB152D00DB0B2B /* ShellScript */ = { \t\t\tisa = PBXShellScriptBuildPhase; \t\t\tbuildActionMask = 2147483647; \t\t\tfiles = ( \t\t\t); \t\t\tinputFileListPaths = ( \t\t\t); \t\t\tinputPaths = ( \t\t\t); \t\t\toutputFileListPaths = ( \t\t\t); \t\t\toutputPaths = ( \t\t\t); \t\t\trunOnlyForDeploymentPostprocessing = 0; \t\t\tshellPath = /bin/sh; \t\t\tshellScript = "if [[ \\"$(uname -m)\\" == arm64 ]]; then\\n export PATH=\\"/opt/homebrew/bin:$PATH\\"\\nfi\\n\\nif which swiftlint > /dev/null; then\\n swiftlint\\nelse\\n echo \\"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\\"\\nfi\\n"; \t\t}; /* End PBXShellScriptBuildPhase section */ CONFIG
Instance Method Summary collapse
- #copy_github_linters_markdown_link_check_config_file ⇒ Object
-
#copy_github_linters_rubocop_config_file ⇒ Object
TODO: copy_rubocop_github_workflow_action.
- #copy_megalinter_dot_file ⇒ Object
- #copy_megalinter_github_workflow_action ⇒ Object
- #copy_rubocop_options_file ⇒ Object
- #create_gitignore_if_missing ⇒ Object
- #gitignore_reports_folder ⇒ Object
- #gitignore_rubocop_cached_file ⇒ Object
- #inject_swiftlint_into_xcode_project_build_process ⇒ Object
Instance Method Details
#copy_github_linters_markdown_link_check_config_file ⇒ Object
47 48 49 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 47 def copy_github_linters_markdown_link_check_config_file copy_file '.github/linters/.markdown-link-check.json' end |
#copy_github_linters_rubocop_config_file ⇒ Object
TODO: copy_rubocop_github_workflow_action
43 44 45 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 43 def copy_github_linters_rubocop_config_file copy_file '.github/linters/rubocop_defaults.yml' end |
#copy_megalinter_dot_file ⇒ Object
55 56 57 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 55 def copy_megalinter_dot_file copy_file '.mega-linter.yml' end |
#copy_megalinter_github_workflow_action ⇒ Object
51 52 53 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 51 def copy_megalinter_github_workflow_action copy_file '.github/workflows/mega-linter.yml' end |
#copy_rubocop_options_file ⇒ Object
71 72 73 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 71 def copy_file '.rubocop' end |
#create_gitignore_if_missing ⇒ Object
59 60 61 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 59 def create_gitignore_if_missing create_file_if_missing '.gitignore' end |
#gitignore_reports_folder ⇒ Object
63 64 65 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 63 def gitignore_reports_folder append_to_file '.gitignore', "megalinter-reports/\n" end |
#gitignore_rubocop_cached_file ⇒ Object
67 68 69 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 67 def gitignore_rubocop_cached_file append_to_file '.gitignore', ".rubocop-https---*\n" end |
#inject_swiftlint_into_xcode_project_build_process ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/way_of_working/code_linting/hdi/generators/init_linters.rb', line 75 def inject_swiftlint_into_xcode_project_build_process return unless xcode_project_file && File.exist?(xcode_project_file) inject_into_file xcode_project_file, LINTING_BUILD_PHASE, after: "buildPhases = (\n" inject_into_file xcode_project_file, LINTING_BUILD_PHASE_DETAILS, after: "/* End PBXResourcesBuildPhase section */\n\n" end |