Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Rubocop linting with Solargraph 0.50 when using Kate Editor #703

Open
rriemann opened this issue Dec 30, 2023 · 3 comments
Open

No Rubocop linting with Solargraph 0.50 when using Kate Editor #703

rriemann opened this issue Dec 30, 2023 · 3 comments

Comments

@rriemann
Copy link

Dear all,

I want to use solargraph inside of Kate Editor to receive rubocop linting.

I get method definitions and method completition popups in kate. However, linting is not working.

My Kate settings:

image

Screenshot of an editing session:

image

My solargraph config:

---
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
formatter:
  rubocop:
    cops: safe
    except: []
    only: []
    extra_args: []
require_paths: []
plugins: []
max_files: 5000

Rubocop config .rubocop.yml:

File content

---
AllCops:
  TargetRubyVersion: 3.1
  Include:
  - lib/**/*.rb
  # - spec/**/*.rb
  NewCops: enable
  SuggestExtensions: false
Layout/EndAlignment:
  Severity: error
Lint/UnreachableCode:
  Severity: error
Lint/UselessAccessModifier:
  Enabled: false
Metrics/AbcSize:
  Max: 20
Metrics/BlockLength:
  Exclude:
    - spec/**/*.rb
Metrics/ClassLength:
  Max: 300
  Exclude:
  - !ruby/regexp /spec\/.*.rb$/
Metrics/CyclomaticComplexity:
  Max: 8
Layout/LineLength:
  Exclude:
    - Rakefile
    - Gemfile
    - jekyll-maps.gemspec
  Max: 90
  Severity: warning
Metrics/MethodLength:
  Max: 20
  CountComments: false
  Severity: error
Metrics/ModuleLength:
  Max: 240
Metrics/ParameterLists:
  Max: 4
Metrics/PerceivedComplexity:
  Max: 8
Style/Alias:
  Enabled: false
Style/AndOr:
  Severity: error
Style/Attr:
  Enabled: false
Style/ClassAndModuleChildren:
  Enabled: false
Style/Documentation:
  Enabled: false
Style/DoubleNegation:
  Enabled: false
Layout/EmptyLinesAroundAccessModifier:
  Enabled: false
Layout/EmptyLinesAroundModuleBody:
  Enabled: false
Layout/ExtraSpacing:
  AllowForAlignment: true
Naming/FileName:
  Enabled: false
Layout/FirstParameterIndentation:
  EnforcedStyle: consistent
Style/GuardClause:
  Enabled: false
Style/HashSyntax:
  EnforcedStyle: hash_rockets
  Severity: error
Style/IfUnlessModifier:
  Enabled: false
Layout/IndentationWidth:
  Severity: error
Style/ModuleFunction:
  Enabled: false
Layout/MultilineMethodCallIndentation:
  EnforcedStyle: indented
Layout/MultilineOperationIndentation:
  EnforcedStyle: indented
Style/MultilineTernaryOperator:
  Severity: error
Style/PercentLiteralDelimiters:
  PreferredDelimiters:
    "%q": "{}"
    "%Q": "{}"
    "%r": "!!"
    "%s": "()"
    "%w": "()"
    "%W": "()"
    "%x": "()"
Style/RedundantReturn:
  Enabled: false
Style/RedundantSelf:
  Enabled: false
Style/RegexpLiteral:
  EnforcedStyle: percent_r
Style/RescueModifier:
  Enabled: false
Style/SignalException:
  EnforcedStyle: only_raise
Style/SingleLineMethods:
  Enabled: false
Layout/SpaceAroundOperators:
  Enabled: false
Style/StringLiterals:
  EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
  EnforcedStyle: double_quotes
Style/RedundantCapitalW:
  Enabled: false
Style/SymbolArray:
  Enabled: false

I have configured to use ruby-3.1.2 with rvm (.ruby-version file). Kate Version 23.08.2 on opensuse tumbleweed linux 64bit

Any ideas how I can get it working? Once this is working, I can help to document this for a kate section at https://solargraph.org/guides .

@castwide
Copy link
Owner

Try turning on diagnostics with an initializationOptions or settings object.

"ruby": {
  "initializationOptions": {
    "diagnostics": true
  }
}

or

"ruby": {
  "settings": {
    "diagnostics": true
  }
}

@rriemann
Copy link
Author

rriemann commented Jan 2, 2024

I added:

      "ruby": {
        "settings": {
          "diagnostics": true
        }
      },

Since then, it seems to work:

image

Note however, that diagnostics was activated in the Kate menu before and this was not enough:

image

I ask in the Kate community what the expected behaviour of this menu is.

@castwide
Copy link
Owner

castwide commented Jan 2, 2024

Fair point. In the early days of Solargraph, diagnostics support was experimental, so it was disabled by default. Nowadays, diagnostics work well and are configurable through .solargraph.yml, so it make sense to enable it by default now. I'll look into making that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants