sds / haml-lint

Tool for writing clean and consistent HAML
MIT License
318 stars 101 forks source link

possible bug report: no _dump_data is defined for class Proc (TypeError) #400

Closed compwron closed 1 year ago

compwron commented 1 year ago

running in internal CI (buildkite on aws) succeeded on re-run it could be something weird with our CI somehow, but unclear what or how? I've never seen this before this runs 100+ times a day just fine usually

+ echo '--- Linting files'
--
  | Linting files | 39s
  | + bundle exec haml-lint --parallel
  | warning: parser/current is loading parser/ruby31, which recognizes3.1.3-compliant syntax, but you are running 3.1.2.
  | Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:566:in `dump': no _dump_data is defined for class Proc (TypeError)
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:566:in `process_incoming_jobs'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:537:in `block in worker'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:528:in `fork'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:528:in `worker'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:519:in `block in create_workers'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:518:in `each'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:518:in `each_with_index'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:518:in `create_workers'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:457:in `work_in_processes'
  | from /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:294:in `map'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/runner.rb:149:in `warm_cache'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/runner.rb:140:in `report'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/runner.rb:28:in `run'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/cli.rb:108:in `scan_for_lints'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/cli.rb:53:in `act_on_options'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/lib/haml_lint/cli.rb:25:in `run'
  | from /usr/local/bundle/gems/haml_lint-0.43.0/bin/haml-lint:8:in `<top (required)>'
  | from /usr/local/bundle/bin/haml-lint:25:in `load'
  | from /usr/local/bundle/bin/haml-lint:25:in `<top (required)>'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli/exec.rb:58:in `load'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli/exec.rb:58:in `kernel_load'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli/exec.rb:23:in `run'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli.rb:491:in `exec'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli.rb:34:in `dispatch'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/cli.rb:28:in `start'
  | from /usr/local/bundle/gems/bundler-2.4.3/exe/bundle:45:in `block in <top (required)>'
  | from /usr/local/bundle/gems/bundler-2.4.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
  | from /usr/local/bundle/gems/bundler-2.4.3/exe/bundle:33:in `<top (required)>'
  | from /usr/local/bundle/bin/bundle:25:in `load'
  | from /usr/local/bundle/bin/bundle:25:in `<main>'
  | marshal data too short
  | <internal:marshal>:34:in `load'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:84:in `work'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:482:in `block (4 levels) in work_in_processes'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:597:in `with_instrumentation'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:481:in `block (3 levels) in work_in_processes'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:469:in `loop'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:469:in `block (2 levels) in work_in_processes'
  | /usr/local/bundle/gems/parallel-1.22.1/lib/parallel.rb:222:in `block (4 levels) in in_threads'
  | Report this bug at https://github.com/sds/haml-lint/issues
  |  
  | To help fix this issue, please include:
  | - The above stack trace
  | - Haml-Lint version: 0.43.0
  | - Haml version: 5.2.2
  | - RuboCop version: 1.22.3
  | - Ruby version: 3.1.2

.haml-lint.yml

require:
  - "./linters/views/javascript_pack_tag.rb"

skip_frontmatter: false

linters:
  AlignmentTabs:
    enabled: true

  AltText:
    enabled: false

  ClassAttributeWithStaticValue:
    enabled: true

  ClassesBeforeIds:
    enabled: true

  ConsecutiveComments:
    enabled: true
    max_consecutive: 1

  # todo: reenable. this doesn't seem like it was working
  ConsecutiveSilentScripts:
    enabled: false
    max_consecutive: 2

  EmptyObjectReference:
    enabled: true

  EmptyScript:
    enabled: true

  FinalNewline:
    enabled: true
    present: true

  HtmlAttributes:
    enabled: true

  # todo: reenable. this doesn't seem like it was working
  IdNames:
    enabled: false
    style: lisp_case

  ImplicitDiv:
    enabled: true

  Indentation:
    enabled: true
    character: space # or tab
    width: 2 # ignored if character == tab

  InlineStyles:
    enabled: true
    exclude:
      - <redacted>

  # todo: reenable. this doesn't seem like it was working
  InstanceVariables:
    enabled: false
    file_types: partials
    matchers:
      all: .*
      partials: \A_.*\.haml\z

  JavascriptPackTag:
    enabled: true

  LeadingCommentSpace:
    enabled: true

  LineLength:
    enabled: false
    max: 100

  MultilinePipe:
    enabled: true

  MultilineScript:
    enabled: true

  ObjectReferenceAttributes:
    enabled: true

  RepeatedId:
    enabled: true
    severity: error

  RuboCop:
    enabled: true
    # These cops are incredibly noisy when it comes to HAML templates, so we
    # ignore them.
    ignored_cops:
      - Layout/TrailingEmptyLines
      - Lint/BlockAlignment
      - Lint/EndAlignment
      - Lint/Void
      - Metrics/BlockLength
      - Layout/LineLength
      - Style/AlignParameters
      - Style/BlockNesting
      - Style/DateTime
      - Style/ElseAlignment
      - Style/EndOfLine
      - Style/FileName
      - Style/FinalNewline
      - Style/FrozenStringLiteralComment
      - Style/IfUnlessModifier
      - Style/IndentationWidth
      - Style/Next
      - Style/NumericPredicate
      - Style/StringLiterals
      - Style/TrailingBlankLines
      - Style/TrailingWhitespace
      - Style/WhileUntilModifier

    exclude:
      - <redacted>

  RubyComments:
    enabled: true

  SpaceBeforeScript:
    enabled: true

  # todo: reenable. this doesn't seem like it was working
  SpaceInsideHashAttributes:
    enabled: false
    style: space

  TagName:
    enabled: true

  TrailingWhitespace:
    enabled: true

  UnnecessaryInterpolation:
    enabled: true

  UnnecessaryStringOutput:
    enabled: true

  ViewLength:
    enabled: true
    exclude:
      - <redacted>

exclude:
  - <redacted>
compwron commented 1 year ago

This may be the same as https://github.com/sds/haml-lint/issues/345 ?

compwron commented 1 year ago

more information:

I was able to replicate this error on a different computer when running without parallel, the error came out as:

redacted.html.haml:10 [W] UnnecessaryStringOutput: `= "..."` should be rewritten as `...`
gstokkink commented 1 year ago

Running into this as well for some Rubocop errors lately.