ServiceInnovationLab/RapuTure

View on GitHub
app/views/scenarios/_outputs.html.haml

Summary

Maintainability
Test Coverage

Lint/UnusedBlockArgument: Unused block argument - i. If it's necessary, use _ or _i as an argument name to indicate that it won't be used.
Open

                  - item.each_with_index.map do |array_item, i|

HamlLint/RuboCop

Option Description
ignored_cops Array of RuboCop cops to ignore.

This linter integrates with RuboCop (a static code analyzer and style enforcer) to check the actual Ruby code in your templates. It will respect any RuboCop-specific configuration you have set in .rubocop.yml files, but will explicitly ignore some checks that don't make sense in the context of HAML documents (like Style/BlockAlignment).

-# example.haml
- name = 'James Brown'
- unused_variable = 42

%p Hello #{name}!

Output from haml-lint example.haml:3 [W] Useless assignment to variable - unused_variable

You can customize which RuboCop warnings you want to ignore by modifying the ignored_cops option (see config/default.yml for the full list of ignored cops).

You can also explicitly set which RuboCop configuration to use via the HAML_LINT_RUBOCOP_CONF environment variable. This is intended to be used by external tools which run the linter on files in temporary directories separate from the directory where the HAML template originally resided (and thus where the normal .rubocop.yml would be picked up).

Displaying Cop Names

You can display the name of the cop by adding the following to your .rubocop.yml configuration:

AllCops:
  DisplayCopNames: true

Avoid using instance variables in partials views
Open

                = @scenario.input_persons.keys[key]

HamlLint/InstanceVariables

Checks that instance variables are not used in the specified type of files.

Option Description
file_types The class of files to lint (default partial)
matchers The regular expressions to check file names against.

By default, this linter only runs on Rails-style partial views, e.g. files that have a base name starting with a leading underscore _. If you want to ensure that you don't use any instance variables at all, you can set file_types to all.

You can also define your own matchers if you want to enable this linter on a different subset of your views. For instance, if you want to lint only files starting with special_, you can define the configuration as follows:

InstanceVariables:
  enabled: true
  file_types: special
  matchers:
    special: ^special_.*\.haml$

To avoid using instance variables in partials, ensure you are passing any needed variables as local variables. Alternatively, you can use only helper methods to place data in your views.

There are no issues that match your filters.

Category
Status