Coder Social home page Coder Social logo

Comments (4)

shaopeng-gh avatar shaopeng-gh commented on August 29, 2024

Could be by design.
A Windows user may get confused because expecting a folder path with or without ending \ to be same.

from credo.

rrrene avatar rrrene commented on August 29, 2024

Oh, that is not by design. Thx for reporting!

Could you check if the result is the same for

mix credo suggest --working-dir C:\Task\lsp_credo\ --format json

?

from credo.

shaopeng-gh avatar shaopeng-gh commented on August 29, 2024

just tried, adding --working-dir before the path
mix credo suggest --working-dir C:\Task\lsp_credo\ --format json
results in:

No files found!

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.00 seconds (0.00s to load, 0.00s running 52 checks on 0 files)
0 mods/funs, found no issues.

Showing priority issues: 鈫?鈫?鈫? (use `mix credo explain` to explain issues, `mix credo --help` for options).

removing --working-dir before the path :
mix credo suggest C:\Task\lsp_credo\ --format json

Checking 5 source files ...

  Software Design
鈹?
鈹?[D] 鈫?Nested modules could be aliased at the top of the invoking module.
鈹?      lib/lsp_credo.ex:223:21 #(LspCredo.issue_to_sarif)
鈹?[D] 鈫?Nested modules could be aliased at the top of the invoking module.
鈹?      lib/lsp_credo.ex:220:50 #(LspCredo.issue_to_sarif)
鈹?[D] 鈫?Nested modules could be aliased at the top of the invoking module.
鈹?      lib/lsp_credo.ex:216:17 #(LspCredo.issue_to_sarif)

  Code Readability
鈹?
鈹?[R] 鈫?Space missing after comma
鈹?      lib/lsp_credo.ex:141:71 #(LspCredo.print_issues)
鈹?[R] 鈫?Space missing after comma
鈹?      lib/lsp_credo.ex:141:68 #(LspCredo.print_issues)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      lib/lsp_credo.ex:145 #(LspCredo.print_issues)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      lib/lsp_credo.ex:137 #(LspCredo.print_issues)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      lib/lsp_credo.ex:136 #(LspCredo.print_issues)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:18 #(LspCredoTest)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:17 #(LspCredoTest)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:16 #(LspCredoTest)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:15 #(LspCredoTest)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:14 #(LspCredoTest)
鈹?[R] 鈫?There should be no more than 1 consecutive blank lines.
鈹?      test/lsp_credo_test.exs:13 #(LspCredoTest)

  Consistency
鈹?
鈹?[C] 鈫?File is using windows line endings while most of the files use unix line
鈹?      endings.
鈹?      lib/ui.ex:1 #(Credo.CLI.Output.UI)
鈹?[C] 鈫?File is using windows line endings while most of the files use unix line
鈹?      endings.
鈹?      lib/issue.ex:1 #(Credo.Issue)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.1 seconds (0.05s to load, 0.06s running 64 checks on 5 files)
35 mods/funs, found 2 consistency issues, 11 code readability issues, 3 software design suggestions.

Use `mix credo explain` to explain issues, `mix credo --help` for options.

using mix credo suggest C:\Task\lsp_credo --format json:

{
  "issues": [
    {
      "category": "consistency",
      "check": "Credo.Check.Consistency.LineEndings",
      "column": null,
      "column_end": null,
      "filename": "lib/issue.ex",
      "line_no": 1,
      "message": "File is using windows line endings while most of the files use unix line endings.",
      "priority": 11,
      "scope": "Credo.Issue",
      "trigger": "\r\n"
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.SpaceAfterCommas",
      "column": 68,
      "column_end": 70,
      "filename": "lib/lsp_credo.ex",
      "line_no": 141,
      "message": "Space missing after comma",
      "priority": 3,
      "scope": "LspCredo.print_issues",
      "trigger": ",["
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.SpaceAfterCommas",
      "column": 71,
      "column_end": 73,
      "filename": "lib/lsp_credo.ex",
      "line_no": 141,
      "message": "Space missing after comma",
      "priority": 3,
      "scope": "LspCredo.print_issues",
      "trigger": ",["
    },
    {
      "category": "design",
      "check": "Credo.Check.Design.AliasUsage",
      "column": 17,
      "column_end": 32,
      "filename": "lib/lsp_credo.ex",
      "line_no": 216,
      "message": "Nested modules could be aliased at the top of the invoking module.",
      "priority": -7,
      "scope": "LspCredo.issue_to_sarif",
      "trigger": "Credo.Code.Name"
    },
    {
      "category": "design",
      "check": "Credo.Check.Design.AliasUsage",
      "column": 50,
      "column_end": 65,
      "filename": "lib/lsp_credo.ex",
      "line_no": 220,
      "message": "Nested modules could be aliased at the top of the invoking module.",
      "priority": -7,
      "scope": "LspCredo.issue_to_sarif",
      "trigger": "Credo.Code.Name"
    },
    {
      "category": "design",
      "check": "Credo.Check.Design.AliasUsage",
      "column": 21,
      "column_end": 36,
      "filename": "lib/lsp_credo.ex",
      "line_no": 223,
      "message": "Nested modules could be aliased at the top of the invoking module.",
      "priority": -7,
      "scope": "LspCredo.issue_to_sarif",
      "trigger": "Credo.Code.Name"
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "lib/lsp_credo.ex",
      "line_no": 136,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -7,
      "scope": "LspCredo.print_issues",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "lib/lsp_credo.ex",
      "line_no": 137,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -7,
      "scope": "LspCredo.print_issues",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "lib/lsp_credo.ex",
      "line_no": 145,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -7,
      "scope": "LspCredo.print_issues",
      "trigger": null
    },
    {
      "category": "consistency",
      "check": "Credo.Check.Consistency.LineEndings",
      "column": null,
      "column_end": null,
      "filename": "lib/ui.ex",
      "line_no": 1,
      "message": "File is using windows line endings while most of the files use unix line endings.",
      "priority": 12,
      "scope": "Credo.CLI.Output.UI",
      "trigger": "\r\n"
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 13,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 14,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 15,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 16,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 17,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    },
    {
      "category": "readability",
      "check": "Credo.Check.Readability.RedundantBlankLines",
      "column": null,
      "column_end": null,
      "filename": "test/lsp_credo_test.exs",
      "line_no": 18,
      "message": "There should be no more than 1 consecutive blank lines.",
      "priority": -9,
      "scope": "LspCredoTest",
      "trigger": null
    }
  ]
}

from credo.

rrrene avatar rrrene commented on August 29, 2024

Finally got my hands on a windows machine with Elixir on it.

This is not a bug with Credo, but rather a peculiar situation with the shell:

If we output the argv of the mix task, then running

mix credo suggest --working-dir C:\Users\renef\test_ex\ --format json

results in (formatted for easier reading):

[
  "suggest",
  "--working-dir",
  "C:\\Users\\renef\\test_ex\" --format json"
]

So the backslash at the end of the directory is interpreted as an escape for the next character instead of a directory delimiter.

You can test this by adding a Mix task that does this:

defmodule Mix.Tasks.Credo do
  use Mix.Task

  def run(argv) do
    IO.inspect(argv, label: "argv")
  end
end

So, there is unfortunately nothing Credo can do about this 🤷‍♂️

from credo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.