nhat-phan / shit-cleaner

An Intellij IDE plugin which uses Code Climate CLI to analyze your source code on local machine and display code smells/duplications right in your IDE
GNU Affero General Public License v3.0
27 stars 7 forks source link

Allow specifying the configuration format #5

Open bipster opened 4 years ago

bipster commented 4 years ago

The plugin currently has an undocumented requirement for the JSON configuration, so if a project has an existing YAML config, that's silently ignored. Allowing this to be specified, or at least making the requirement clear in the docs, would help adoption for projects that require excluded files/directories.

bipster commented 4 years ago

Actually, I think I misunderstood the code. Does the plugin look at the project's CodeClimate config at all (e.g. if there's a .codeclimate.json file in the root)? The analysis via the plugin never finishes, which I solved via command-line by excluding files via the config.

nhat-phan commented 4 years ago

@bipster you're right, if you want to exclude you have to use codeclimate configuration file. Anyway, I have a plan to support multiple codeclimate projects in next release, hope it helps.

bipster commented 4 years ago

Thanks, @nhat-phan !

Even when I exclude all files via the config file, the plugin still claims there are 1,200,000 lines of code and I have to kill it after half an hour of no results. When I do the same via the command line it finishes in seconds.

I think I just realized the problem:

My folder structure is like this:

/project_root/.codeclimate.json
/project_root/module1/
/project_root/module2/
/project_root/module3/
/project_root/module4/

When I am running the CLI, I run it from /project_root. But in my IntelliJ project, I don't load /project_root -- my project is set up so only the four modules are loaded. I think I have to move my .codeclimate.json into /project_root/module1 and exclude paths like "../module2/excluded.txt"?

bipster commented 4 years ago

I tried to let the plugin analyzation go as long as it needed but get "error: (CC::CLI::Analyze::EngineFailure) engine duplication ran for 900 seconds and was killed". I increased IJ's memory to 4G, and Docker's to 5G, but the CPU still runs at 400+% and the memory usage spikes. Neither happens when I run from the command-line.