Giter Club home page Giter Club logo

codacy / codacy-analysis-cli Goto Github PK

View Code? Open in Web Editor NEW
93.0 16.0 33.0 1.6 MB

The Codacy Analysis CLI is a command line interface that enables you to execute Codacy code analysis locally.

Home Page: https://www.codacy.com

License: GNU Affero General Public License v3.0

Makefile 0.12% Shell 1.16% Scala 80.02% Go 0.48% JavaScript 12.45% Python 0.82% Ruby 4.90% Dockerfile 0.05%
static-analysis codacy scala command-line-tool command-line command-line-app command-line-interface linter lint

codacy-analysis-cli's Introduction

Codacy Analysis CLI

Codacy Badge Codacy Badge CircleCI Docker Version Maven Central

Command line interface to execute Codacy code analysis locally.

With a single command you can:

  • Get static code analysis issues, complexity, duplication and other code metrics
  • Run a tool or the whole suite of supported tools by Codacy
  • Use the tools' default patterns, your configuration files or your settings saved on Codacy

Prerequisites

Usage

  • Java 8+
  • Docker 17.09+

Development

  • Java 8+
  • SBT 1.1.x
  • Scala 2.12.x
  • Docker 17.09+

Install

curl -L https://github.com/codacy/codacy-analysis-cli/archive/master.tar.gz | tar xvz
cd codacy-analysis-cli-* && sudo make install

Windows

Pre-Requisites

Docker Configuration

Once the pre-requisites are met, it’s time to enable the connectivity between bash and docker.

It’s mandatory that the daemon is exposed without TLS. In order to do that go to Docker Settings -> General. Just click on the checkbox with the label 'Expose daemon on tcp://localhost:2375 without TLS' and docker will reload.

Preparing docker client on bash

Now it’s time to go to the bash and install and configure the docker client.

If you are using Windows 10 (build above 1803) the following command will make the docker client available from the bash sudo ln -s "/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe" /usr/local/bin/docker

If you are using a previous version of Windows 10, here you can find a very easy tutorial to follow.

Since you’ll be using the WSL, the variable DOCKER_HOST needs to be configured to tcp://0.0.0.0:2375, in order to do that just type the following command on the bash

export DOCKER_HOST=tcp://0.0.0.0:2375

It’s also possible to add this variable to your .bashrc or .bash_profile files so that the variable is always ready when you start the bash

echo "export DOCKER_HOST=tcp://0.0.0.0:2375" >> ~/.bash_profile

echo "export DOCKER_HOST=tcp://0.0.0.0:2375" >> ~/.bashrc

Mac

If you are using Apple silicon, please make sure to:

  • Update Docker to the latest version
  • Open Docker Settings
  • Turn on Use Rosetta for x86/amd64 emulation on Apple Silicon (under Features in development)

Installing codacy-analysis-cli

At this point, codacy-analysis-cli is ready to be installed.

In bash, go to the folder you want to download the tool into and type the following commands:

sudo apt-get install make

curl -L https://github.com/codacy/codacy-analysis-cli/archive/master.tar.gz | tar xvz

cd codacy-analysis-cli-*

Once again, due to the use of the WSL, it’s mandatory to add the two highlighted lines to the Makefile in this directory.

Before the test section:

export DOCKER_HOST=tcp://0.0.0.0:2375

and, in the install, section:

docker login

Finally, just type the following command and the installation will start

sudo make install

When Docker’s username is required, be sure to write the username and not the e-mail because depending on how you’ve created your docker account, they might be different.

Usage

Script

codacy-analysis-cli analyze \
  --tool <TOOL-SHORT-NAME> \
  --directory <SOURCE-CODE-PATH>

Java

java -jar codacy-analysis-cli-assembly-{VERSION}.jar analyze \
  --tool <TOOL-SHORT-NAME> \
  --directory <SOURCE-CODE-PATH> \
  # other options

Local

sbt "codacyAnalysisCli/runMain com.codacy.analysis.cli.Main analyze --tool <TOOL-SHORT-NAME> --directory <SOURCE-CODE-PATH>"

Docker

docker run \
  --rm=true \
  --env CODACY_CODE="$CODACY_CODE" \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume "$CODACY_CODE":"$CODACY_CODE" \
  --volume /tmp:/tmp \
  codacy/codacy-analysis-cli \
    analyze --tool <TOOL-SHORT-NAME>

Output

The default format for the CLI output is text and is divided into 3 categories:

Issues

Issues reported by the tools that vary between 3 different levels (Error, Warning and Info). Example:

Found [Error] `Expected "#E1675A" to be "#e1675a" (color-hex-case)` in styles/variables.less:4 (Stylelint_color-hex-case)
Found [Warning] `'object short notation' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).` in scripts/main.js:28 (iterator)
Found [Info] `Missing semicolon.` in views/components/Progress.jsx:18 (asi)

Metrics

The metrics data is printed for each file and contains 5 types of data:

  • LOC - Lines of Code
  • CLOC - Commented Lines of Code
  • CC - Cyclomatic Complexity
  • #methods - Number of methods
  • #classes - Number of classes

Example:

Found [Metrics] in generic/Test.java:
  CC - 33
  LOC - 778
  CLOC - 864
  #methods - 3
  #classes - 1

Clones

Each clone found is printed with information about the total number of lines, number of tokens and all the occurrences (the lines where it starts and where it ends). Example:

Found [Clone] 7 duplicated lines with 10 tokens:
  generic/test.rb
    l. 681 - 687
    l. 693 - 699
  generic/another_test.rb
    l. 601 - 607
    l. 193 - 199

Exit Status Codes

  • 🎉 0: Success
  • 😵 1: Generic Error
  • 😴 2: Timeout
  • 😩 10: Failed Upload
  • 😕 11: Uncommited changes in project (with upload option selected)
  • 😮 12: The commit uuid passed by parameter does not match the current commit of the project's repository
  • 😠 13: Non-existent tool provided as input
  • 😰 100: Failed Analysis
  • 😦 101: Partially Failed Analysis
  • 👮 102: Max Allowed Issues Exceeded

Configuration

Commands and Configuration

  • analyze - Run a Codacy analysis over a directory/files
    • --help - Displays all the configuration options, their meaning and possible values.
    • --verbose - Run the tool with verbose output
    • --tool - Choose the tool to analyze the code (e.g. brakeman), or "metrics", "duplication", "issues" to run only a specific tool category
    • --directory - Choose the directory to be analysed
    • --codacy-api-base-url or env.CODACY_API_BASE_URL - Change the Codacy installation API URL to retrieve the configuration (e.g. Enterprise installation)
    • --output - Send the output results to a file
    • --format [default: text] - Change the output format (e.g. json)
    • --commit-uuid [default: latest commit of current git branch] - Set the commit UUID that will receive the results on Codacy
    • --skip-commit-uuid-validation [default: false] - Force using a commit UUID even if it doesn't belong to the current git branch.
    • --skip-uncommitted-files-check [default: false] - Skip check for uncommitted files in the analysis directory
    • --upload [default: false] - Request to push results to Codacy
    • --upload-batch-size [default: 50000] - Maximum number of results in each batch to upload to Codacy
    • --skip-ssl-verification [default: false] - Skip the SSL certificate verification when communicating with the Codacy API
    • --parallel [default: 2] - Number of tools to run in parallel
    • --max-allowed-issues [default: 0] - Maximum number of issues allowed for the analysis to succeed
    • --fail-if-incomplete [default: false] - Fail the analysis if any tool fails to run
    • --allow-network [default: false] - Allow network access, so tools that need it can execute (e.g. findbugs)
    • --force-file-permissions [default: false] - Force files to be readable by changing the permissions before running the analysis
    • --tool-timeout [default: 15minutes] - Maximum time each tool has to execute (e.g. 15minutes, 1hour)
    • --max-tool-memory [default: 3g] - Maximum of allowed memory for each tool execution (in bytes or using the notation of Docker's memory limit flags)
    • --tmp-directory [optional] - Temporary directory for analysis purposes
    • --gh-code-scanning-compat [default: false] - Reduce issue severity by one level, for non-security issues, for compatibility with GitHub's code scanning feature. This option will only have an effect when used in conjunction with --format sarif. Note that in this case, the same issues on Codacy side will have higher priority.
  • validate-configuration - Validate the Codacy configuration file
    • --directory - Choose the directory where to look for the Codacy configuration file

Environment Variables

  • CODACY_ANALYSIS_CLI_VERSION [default: stable] - Set an alternative version of the CLI to run. (e.g. latest, 0.1.0-alpha3.1350, ...)
  • SKIP_CONTAINER_ENGINE_CHECK [default: false] - Skip the initial test for presence of docker socket (useful when running in systems that dont have the docker socket available)

Local configuration

To perform certain advanced configurations, Codacy allows to create a configuration file. Check our documentation for more details.

Remote configuration

To run locally the same analysis that Codacy does in your code you can request remotely the configuration.

Project Token

See how to generate a project token.

⚠️ Warning: For security reasons we recommend that you store your project API token in the environment variable CODACY_PROJECT_TOKEN instead of setting --project-token.

codacy-analysis-cli analyze \
  --project-token <PROJECT-TOKEN> \
  --tool <TOOL-SHORT-NAME> \
  --directory <SOURCE-CODE-PATH>

API Token

See how to generate an account API token.

⚠️ Warning: For security reasons we recommend that you store your account API token in the environment variable CODACY_API_TOKEN instead of setting --api-token.

The provider, username, and project name can be retrieved from the URL in Codacy.

codacy-analysis-cli analyze \
  --api-token <API-TOKEN> \
  --provider <PROVIDER> \
  --username <USERNAME> \
  --project <PROJECT-NAME> \
  --tool <TOOL-SHORT-NAME> \
  --directory <SOURCE-CODE-PATH>

Build

Compile

  • Code

    Note: - Scapegoat runs during compile in Test, to disable it, set NO_SCAPEGOAT.

      sbt compile
    
  • Tests

      sbt test:compile
    

Test

sbt test

Format Code

sbt scalafmtAll scalafmtSbt

Dependency Updates

sbt dependencyUpdates

Static Analysis

sbt scapegoat
sbt scalafix

Coverage

sbt coverage test
sbt coverageReport
sbt coverageAggregate
export CODACY_PROJECT_TOKEN="<TOKEN>"
sbt codacyCoverage

Docker

  • Local

      sbt 'codacyAnalysisCli/stage'
      docker build -t codacy-analysis-cli .
    

Library

  • Local

      sbt 'set version in codacyAnalysisCore := "<VERSION>"' codacyAnalysisCore/publishLocal
    
  • Release

      sbt 'set version in codacyAnalysisCore := "<VERSION>"' 'set pgpPassphrase := Some("<SONATYPE_GPG_PASSPHRASE>".toCharArray)' codacyAnalysisCore/publishSigned
      sbt 'set version in codacyAnalysisCore := "<VERSION>"' sonatypeRelease
    

Breaking Changes

  • 7.0.0: Fix --parallel that wasn't making the tools run actually in parallel. To restore the previous behaviour use --parallel 1

  • 4.0.0: Rename analyse command to analyze. This is a breaking change if you are running the CLI by using the jar or sbt, but not if you are using the provided script.

What is Codacy

Codacy is a platform that monitors your technical debt, helps you improve your code quality and security, teaches best practices to your developers, and helps you save time in code reviews. We help developers ship billions of lines of code per day by automating and standardizing code reviews.
Integrating seamlessly into workflows, Codacy helps engineering teams save time in code reviews and find, fix, and prevent coding defects that would otherwise stack up as technical debt. Our platform uses Artificial Intelligence to suggest code quality fixes. Codacy supports 40+ languages & frameworks and is available in free open-source.

Start a free trial to learn more.

Among Codacy’s features

  • Identify new Static Analysis issues
  • Track issues in Code Style, Security, Error Proneness, Performance, Unused Code, and other categories
  • Leverage AI to automatically explain issues and suggest fixes
  • Integrate seamlessly with your favorite dev tools (Slack, Jira, Semgrep)
  • Commit and Pull Request Analysis with GitHub, Bitbucket, GitLab (and also direct git repositories)

Codacy also helps keep track of Code coverage, Code duplication, and Code complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

Free for Open Source

Codacy is free for Open Source projects.

codacy-analysis-cli's People

Contributors

afsmeira avatar albertoadami avatar alexbaranowski avatar andreatp avatar anentropic avatar bmbferreira avatar dan-codacy avatar franciscodua avatar h314to avatar heliocodacy avatar hjrocha avatar hugocodacy avatar jaimefjorge avatar josemiguelmelo avatar kidsoncoffee avatar lolgab avatar machadoit avatar miguelmarcelino avatar mrfyda avatar nicklem avatar omaluhacodacy avatar paulopontesm avatar pedrocodacy avatar rtfpessoa avatar rubencodacy avatar scala-steward avatar stefanvacareanu7 avatar tfrgoncalves avatar vascorsd avatar xplosunn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codacy-analysis-cli's Issues

[CY-6627] CODACY_API_BASE_URL environment variable not picked up

I am trying to use codacy-analysis-cli to execute Codacy code analysis locally. I have observed that CODACY_API_BASE_URL is not picked up while using the script or docker run methods. My requirement is to run the analysis for our enterprise version of codacy. I would like to know if this is an expected behaviour or did I miss any steps.

Docker run command that I used.

docker run
--rm=true
--env CODACY_CODE="$CODACY_CODE"
--env CODACY_API_BASE_URL="$CODACY_API_BASE_URL"
--env CODACY_PROJECT_TOKEN="$CODACY_PROJECT_TOKEN"
--volume /var/run/docker.sock:/var/run/docker.sock
--volume "$CODACY_CODE":"$CODACY_CODE"
--volume /tmp:/tmp
codacy/codacy-analysis-cli:stable
analyze --tool eslint --skip-ssl-verification --verbose

CODACY_API_BASE_URL and CODACY_PROJECT_TOKEN are added as environment variables.

Execution logs:

11/17 08:08:23 INFO c.c.a.c.c.Environment:74 - API base URL found in argument --codacy-api-base-url
11/17 08:08:23 INFO c.c.a.c.c.Environment:65 - Using API base URL https://api.codacy.com
11/17 08:08:23 INFO c.c.a.c.c.Environment:72 - Project token not passed through argument --project-token
11/17 08:08:23 INFO c.c.a.c.c.Environment:72 - API token not passed through argument --api-token
11/17 08:08:23 INFO c.c.a.c.c.Environment:74 - Project token found in environment variable CODACY_PROJECT_TOKEN

I am not using --codacy-api-base-url anywhere in my docker run command.

[CY-6628] skip-ssl-verification not working as expected

I am trying to execute analysis locally and upload the report later to our Codacy enterprise version server. I have followed the documentation and added the tag --skip-ssl-verification to skip the SSL verification for my API url.

Below is the command that I've used.

% codacy-analysis-cli analyze
--codacy-api-base-url https://codacy.mydomain.com
--skip-ssl-verification
--tool eslint
--verbose

I can see from debug logs that I am able to successfully get the project analysis configuration from codacy remote server.

11/17 08:29:09 INFO c.c.a.c.clients.CodacyClient:161 - Success getting config file from endpoint "/project/analysis/configuration"
11/17 08:29:09 INFO c.c.a.c.clients.CodacyClient:168 - Success parsing remote configuration
11/17 08:29:09 INFO c.c.a.c.c.Environment:74 - Project directory found in environment variable CODACY_CODE

However, it does not pass when it tries to fetch the tools information. It fails with an SSL error.

11/17 08:29:20 ERROR c.c.a.c.command.AnalyseCommand:111 - Could not get tools due to: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

[CY-3125] codacy-analysis-cli in GitHub Codacy Security Scan Action fails

I have three Java projects, and the Codacy Security Scan works for two of them, but fails for the third. I have attached the log files for the project which fails. I seen a java.lang.IndexOutOfBoundsException thrown in the project where this fails, but I lack the expertise to track down the reason.

All three projects have been published on GitHub, so the logs can be viewed directly in situ. The one which fails is:

the two which succeed are:

I have excluded processing of some file types which appear only in the failing project, but it has made no difference; I cannot figure out what else to try.

logs_59.zip

[CY-6700] Being able to read config from `.codacy.yaml`

Hi
I'm using this cli inside GitHub actions
but I found out that this content in .codacy.yaml file is not working for me (That's not removing my problems related to md files)

exclude_paths:
  - "**.md"

I want to exclude any non go files how to do for that thing?

[TS-434] codacy-analysis-cli validate-configuration does not inform about file not starting with `---`

Hi!

First of all, I'm thankful for Your product. Great job!

Yesterday I was playing with the Codacy config file. In documentation, there is the section with important paragraph https://docs.codacy.com/repositories-configure/codacy-configuration-file/#codacy-configuration-file saying that file must start with the ---.

OFC during writing my own .codacy.yml I somehow missed it. I validated the file with the:

codacy-analysis-cli validate-configuration --directory $(pwd)

And it **did not ** inform me about this mistake.

To sum it up:

File

---
exclude_paths:
  - "**/testsuite/**"

output

Successfully loaded the Codacy configuration file in /home/Alex/tmp/XXX/.codacy.yaml
CodacyConfigurationFile(None, Some(Set(Glob("**/testsuite/**"))), None)

File without ---

exclude_paths:
  - "**/testsuite/**"

output

Successfully loaded the Codacy configuration file in /home/Alex/tmp/XXX/.codacy.yaml
CodacyConfigurationFile(None, Some(Set(Glob("**/testsuite/**"))), None)

I'm believing that for a file that does not begin with --- it should print an error.

Best,
Alex

[CY-3881] Not Compatible with Java 11

Building the Codacy CLI on Linux doesn't support Java 11. You are using the UseCGroupMemoryLimitForHeap feature which has been removed in JDK 11 and replaced with UseContainerSupport. The UseCGroupMemoryLimitForHeap was actually deprecated in Java 10. You can see the ticket that completed the removal of this flag in Java 11. There needs to either be a new branch that supports Java 11, or it should be clearly marked that the CLI only supports Java 8-10. It would be nice if you could provide at the very least a Docker-based compiled version of the CLI that could be used so that Linux users aren't forced to install a bunch of dependencies that we won't be using for anything else but to build/run this tool. Makes Codacy less attractive to use.

[CY-3297] Codacy runs itself even though repository analysis is on

I report the issues in GitHub using an actions workflow file .github/workflows/codacy.yml

# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature.  For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  codacy-security-scan:
    name: Codacy Security Scan 1-2min
    runs-on: ubuntu-latest
    steps:
      # Checkout the repository to the GitHub Actions runner
      - name: Checkout code
        uses: actions/checkout@v2
        
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: npm run build # spec/src/spec.ts needs ../../build which is generated by build script

      # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
      - name: Run Codacy Analysis CLI
        uses: codacy/[email protected]
        with:
          # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
          # You can also omit the token and run the tools that support default configurations
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          verbose: true
          output: results.sarif
          format: sarif
          # Adjust severity of non-security issues
          gh-code-scanning-compat: true
          # Force 0 exit code to allow SARIF file generation
          # This will handover control about PR rejection to the GitHub side
          max-allowed-issues: 2147483647

      # Upload the SARIF file generated in the previous step
      - name: Upload SARIF results file
        uses: github/codeql-action/upload-sarif@v1
        with:
          sarif_file: results.sarif

(https://github.com/kolint/kolint/blob/master/.github/workflows/codacy.yml)

But Codacy still runs on master branch's commits. How do I fix this?

Use without docker

How can this be used without docker? I don't use docker, nor do I plan to use docker, but I'd still like to run my codacy rules locally (it's really within a VM but it's not a container - which really shouldn't be a requirement.) - what options are available to facilitate that?

[CY-6125] ERROR c.c.a.c.a.CodacyPluginsAnalyser:31 - Failed analysis for pmd

As title say.

See here: https://github.com/micro5k/microg-unofficial-installer/runs/6508667291?check_suite_focus=true#step:3:821

ERROR c.c.a.c.a.CodacyPluginsAnalyser:31 - Failed analysis for pmd 
java.lang.Throwable: 
Docker exited with code 1
stdout: 
stderr: May 19, 2022 2:01:39 PM net.sourceforge.pmd.RulesetsFactoryUtils getRuleSets
SEVERE: No rules found. Maybe you misspelled a rule name? (null)
Error executing the tool
java.lang.IllegalArgumentException: No rules found. Maybe you misspelled a rule name? (null)
	at net.sourceforge.pmd.RulesetsFactoryUtils.getRuleSets(RulesetsFactoryUtils.java:51)
	at com.codacy.pmd.PMD$.apply(PMD.scala:66)
	at com.codacy.tools.scala.seed.DockerEngine.executeTool(DockerEngine.scala:53)
	at com.codacy.tools.scala.seed.DockerEngine.$anonfun$main$2(DockerEngine.scala:35)
	at scala.util.Success.map(Try.scala:262)
	at com.codacy.tools.scala.seed.DockerEngine.$anonfun$main$1(DockerEngine.scala:27)
	at scala.util.Success.flatMap(Try.scala:258)
	at com.codacy.tools.scala.seed.DockerEngine.main(DockerEngine.scala:26)
	at com.codacy.Engine.main(Engine.scala)
           
	at com.codacy.plugins.runners.BinaryDockerRunner.$anonfun$run$4(BinaryDockerRunner.scala:84)
	at scala.util.Success.flatMap(Try.scala:251)
	at com.codacy.plugins.runners.BinaryDockerRunner.run(BinaryDockerRunner.scala:69)
	at com.codacy.plugins.results.traits.ToolRunner.$anonfun$apply$2(ToolRunner.scala:77)
	at com.codacy.plugins.results.traits.CodacyDocker$.$anonfun$usingDockerConfig$2(CodacyDocker.scala:45)
	at com.codacy.plugins.utils.FileHelper$.$anonfun$usingNewFile$2(FileHelper.scala:51)
	at scala.util.Try$.apply(Try.scala:213)
	at com.codacy.plugins.utils.FileHelper$.usingNewFile(FileHelper.scala:45)
	at com.codacy.plugins.results.traits.CodacyDocker$.usingConfigPath(CodacyDocker.scala:57)
	at com.codacy.plugins.results.traits.CodacyDocker$.$anonfun$usingDockerConfig$1(CodacyDocker.scala:39)
	at scala.Option.map(Option.scala:230)
	at com.codacy.plugins.results.traits.CodacyDocker$.usingDockerConfig(CodacyDocker.scala:38)
	at com.codacy.plugins.results.traits.ToolRunner.$anonfun$apply$1(ToolRunner.scala:76)
	at scala.util.Try$.apply(Try.scala:213)
	at com.codacy.plugins.results.traits.ToolRunner.apply(ToolRunner.scala:61)
	at com.codacy.plugins.results.traits.ToolRunner.run(ToolRunner.scala:49)
	at com.codacy.analysis.core.tools.Tool.run(Tool.scala:91)
	at com.codacy.analysis.core.analysis.CodacyPluginsAnalyser.analyse(CodacyPluginsAnalyser.scala:25)
	at com.codacy.analysis.cli.analysis.AnalyseExecutor.$anonfun$issues$1(AnalyseExecutor.scala:150)
	at scala.util.Success.flatMap(Try.scala:251)
	at com.codacy.analysis.cli.analysis.AnalyseExecutor.issues(AnalyseExecutor.scala:142)
	at com.codacy.analysis.cli.analysis.AnalyseExecutor.$anonfun$run$5(AnalyseExecutor.scala:66)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:116)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:113)
	at scala.collection.parallel.immutable.ParHashSet$ParHashSetIterator.map2combiner(ParHashSet.scala:81)
	at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1056)
	at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
	at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
	at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
	at scala.collection.parallel.ParIterableLike$Map.tryLeaf(ParIterableLike.scala:1053)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.internal(Tasks.scala:160)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.internal$(Tasks.scala:157)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.internal(Tasks.scala:440)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:150)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
	at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:389)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
	at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync(Tasks.scala:379)
	at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync$(Tasks.scala:379)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.sync(Tasks.scala:440)
	at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult(Tasks.scala:423)
	at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult$(Tasks.scala:416)
	at scala.collection.parallel.ForkJoinTaskSupport.executeAndWaitResult(TaskSupport.scala:60)
	at scala.collection.parallel.ParIterableLike$ResultMapping.leaf(ParIterableLike.scala:960)
	at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
	at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
	at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
	at scala.collection.parallel.ParIterableLike$ResultMapping.tryLeaf(ParIterableLike.scala:955)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
	at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

[CY-3085] CLI cannot use .eslintrc configuration

In <app.codacy.com>, the configuration file needs to be .eslintrc, but in CLI, this does not work:

// .eslintrc
{
  "parseOptions": {
    "ecmaVersion": 6
  }
}

If it is a CLI problem, can .eslintrc also be used as the configuration object for detection? My current processing method is that .eslintrc and .jshintrc exist at the same time

[TCE-898] Codecy cli analysis error

[03/28] 08:51:05 ERROR c.c.a.c.a.CodacyPluginsAnalyser:30 - Failed analysis for eslint.,c.c.a.c.a.CodacyPluginsAnalyser:30 03/28 08:50:07 ERROR c.c.a.c.a.CodacyPluginsAnalyser:30 - Failed analysis for pmd-legacy 03/28 08:50:00 WARN c.c.a.c.command.AnalyseCommand:105 - There are uncommitted changes in the project.c.c.a.c.command.AnalyseCommand:105255

[CY-2997] directory' with relatively path cause an error

But when I try to add a directory, it says

docker: Error response from daemon: invalid volume specification: 'src/peb.js:src/peb.js': invalid mount config for type "volume": invalid mount path: 'src/peb.js' mount path must be absolute.

It seems to need an absolute path, but how to write this absolute path

[TS-181] Error in Makefile uninstall task

In makefile uninstall task, we are removing docker codacy-analysis-cli image having tag latest. This leads to error while uninstalling codacy-analysis-cli using make uninstall command.

Screenshot for reference:
Screenshot 2023-01-20 at 7 58 41 PM

This happens because while executing make install for installing cli, docker image with stable tag is pulled.
Screenshot 2023-01-20 at 7 55 19 PM

[CY-2693] Wrong redirect in https://github.com/codacy/codacy-analysis-cli/releases/latest

This not not a code issue.

https://github.com/codacy/codacy-analysis-cli/releases/latest is currently redirecting to https://github.com/codacy/codacy-analysis-cli/releases/tag/2.1.0 , not https://github.com/codacy/codacy-analysis-cli/releases/tag/3.3.4 , the latest release at the time the problem was noticed.

This is preventing scripts that rely on this information to correctly update codacy-analysis-cli to the latest version (see https://github.com/gasrios/localops/blob/ubuntu_focal_fossa/codacy-analysis-cli.yaml )

[CY-2992] Ask: Where should "esversion" be added?

In my workflow, it says

`'class' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).` in FILENAME:70 (iterator)

So, where should "esversion" be added?
I think can add this to documation

[TS-180] After updating cli to version 7.7.0 and 7.7.1 cli is not working as expected

Whenever I try to execute any cli command, instead of executing the command it's showing usage guide in output.
Steps to repro the issue:

  • Try executing codacy-analysis-cli analyze. It prints usage guide instead of running analysis.
  • Same happens if we try to execute codacy-analysis-cli -v to get the version.

Screenshot attached for reference:

Screenshot 2023-01-20 at 7 49 47 PM

It works fine after reverting back to 7.6.8

[CY-4150] Java jar test error

Hello, I tried to run this on the latest jar release :

 $ java -jar codacy-analysis-cli-assembly-6.1.0.jar analyze \
        --tool brakeman \
        --directory ~/GIT/tabbed

And I got this error : java.lang.NoClassDefFoundError: org/xml/sax/InputSource

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/xml/sax/InputSource
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:108)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at com.codacy.analysis.cli.formatter.Formatter$.<init>(Formatter.scala:33)
	at com.codacy.analysis.cli.formatter.Formatter$.<clinit>(Formatter.scala)
	at com.codacy.analysis.cli.command.Analyze$.apply$default$5(CLIApp.scala:132)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$32$lzycompute(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$32(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$31$lzycompute(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$31(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp.<init>(CLIApp.scala:17)
	at com.codacy.analysis.cli.MainImpl.<init>(Main.scala:11)
	at com.codacy.analysis.cli.Main$.<init>(Main.scala:6)
	at com.codacy.analysis.cli.Main$.<clinit>(Main.scala)
	at com.codacy.analysis.cli.Main.main(Main.scala)
Caused by: java.lang.ClassNotFoundException: org.xml.sax.InputSource
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 22 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/InputSource
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:108)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at com.codacy.analysis.cli.formatter.Formatter$.<init>(Formatter.scala:33)
	at com.codacy.analysis.cli.formatter.Formatter$.<clinit>(Formatter.scala)
	at com.codacy.analysis.cli.command.Analyze$.apply$default$5(CLIApp.scala:132)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$32$lzycompute(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$32(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$31$lzycompute(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp$anon$generic$macro$309$1.inst$macro$31(CLIApp.scala:17)
	at com.codacy.analysis.cli.command.CLIApp.<init>(CLIApp.scala:17)
	at com.codacy.analysis.cli.MainImpl.<init>(Main.scala:11)
	at com.codacy.analysis.cli.Main$.<init>(Main.scala:6)
	at com.codacy.analysis.cli.Main$.<clinit>(Main.scala)
	at com.codacy.analysis.cli.Main.main(Main.scala)
Caused by: java.lang.ClassNotFoundException: org.xml.sax.InputSource
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 22 more

System Linux
Distribution NixOS
Architecture x86_64
java version openjdk 15.0.1

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.