Class: WayOfWorking::CodeLinting::Hdi::Generators::DocumentLinters

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/way_of_working/code_linting/hdi/generators/document_linters.rb

Overview

This class is responsible for generating linter documentation

Constant Summary collapse

SUPPORTED_LINTERS_URL =

URL of the supported linters

'https://megalinter.io/latest/supported-linters/'

Instance Method Summary collapse

Instance Method Details

#create_linters_documentationObject

Method to create the linter documentation using a template



42
43
44
45
# File 'lib/way_of_working/code_linting/hdi/generators/document_linters.rb', line 42

def create_linters_documentation
  template 'docs/way_of_working/code-linting/linters.md'
  copy_file 'docs/way_of_working/code-linting/index.md'
end

#prepare_linter_listsObject

Method to prepare the list of linters from the supported linters URL



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/way_of_working/code_linting/hdi/generators/document_linters.rb', line 25

def prepare_linter_lists
  # Initialize an empty hash for linter types
  @types = {}

  # Iterate over each linter type in the parsed HTML
  parse_linter_types_html do |type, html_rows|
    @types[type] = []

    parse_linter_rows(html_rows) do |constant_name, language, name, link|
      # Create a new linter object and add it to the list
      @types[type] << SupportedLinter.new(language, constant_name, name, link,
                                          enabled_linters)
    end
  end
end