Hello visitor, I’m a pre-final year student (expected May 2021) pursuing Computer Science and Engineering from Delhi Technological University, India. This summer I worked with coala as part of GSoC’19 wherein I created a plugin for Jetbrains IDEs. The plugin provides a unified extension over the current CLI for linting and fixing code right within the IDE. Therefore, developers can focus on writing clean code quickly (and automatically) instead of worrying about running a separate command-line utility.
cc6ee8c8c9acf860f5dfaabc9b61735e74de2a85406372caa423fec2d6ec60a2
Copy Hash valueRepository | Link to Commit/s | Description | |
c | coala-jetbrains | View | Initial commit |
c | coala-jetbrains | View | Add idea files |
c | coala-jetbrains | View | Initialize Plugin |
c | coala-jetbrains | View | plugin.xml: Update plugin metadata |
c | coala-jetbrains | View | CodeAnalysisAction.java: Create Analysis Action |
c | coala-jetbrains | View | CodeAnalysisIssue.java: Create basic layout of class |
c | coala-jetbrains | View | CodeAnalysisIssue.java: Edit basic issue layout |
c | coala-jetbrains | View | CodeAnalysisAction.java: Add logger |
c | coala-jetbrains | View | SourceRange.java: Complete class |
c | coala-jetbrains | View | AffectedCode.java: Add class |
c | coala-jetbrains | View | DeserializeSourceRangeFromJson.java: Add class |
c | coala-jetbrains | View | DeserializeAffectedCodeFromJson.java: Add class |
c | coala-jetbrains | View | DeserializeIssueFromJson.java: Add class |
c | coala-jetbrains | View | CodeAnalysisIssue.java: Rename members |
c | coala-jetbrains | View | DeserializeSourceRangeFromJson & DeserializeIssueFromJson: Explicitly… |
c | coala-jetbrains | View | AffectedCode.java: Add getters for start and end source ranges |
c | coala-jetbrains | View | Make severity enum public |
c | coala-jetbrains | View | build.gradle: Add assertj dependency |
c | coala-jetbrains | View | CodeAnalysisIssueDeserializer.java: Add deserialization code |
c | coala-jetbrains | View | CodeAnalysisIssueDeserializerTest.java: Add corresponding test cases |
c | coala-jetbrains | View | deserializers: Add a new package |
c | coala-jetbrains | View | DeserializeSourceRangeFromJson.java: Check for null column values |
c | coala-jetbrains | View | CodeAnalysisDeserializerTest.java: Split-up test cases |
c | coala-jetbrains | View | plugin.xml: Add a new group for coala |
c | coala-jetbrains | View | .coafile: Add .coafile |
c | coala-jetbrains | View | .coafile: Create section for all files |
c | coala-jetbrains | View | .travis.yml: Add travis configuration file |
c | coala-jetbrains | View | travis.sh: Add script to build plugin and run tests |
c | coala-jetbrains | View | .travis.yml: Change travish.sh location |
c | coala-jetbrains | View | .coafile: Fix enabled typo |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Add GeneralCommandLine |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Add submit method |
c | coala-jetbrains | View | CodeAnalysisRunnerTest.java: Add tests for GeneralCommandLine |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Add ProcessOutput for capturing output |
c | coala-jetbrains | View | ProjectSettings.java: Add class to hold settings |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Use ProjectSettings class |
c | coala-jetbrains | View | CodeAnalysisTask.java: Add class for running process |
c | coala-jetbrains | View | CodeAnalysisExecutor.java: Add class for executing process |
c | coala-jetbrains | View | plugin.xml: Add project components |
c | coala-jetbrains | View | build.gradle: Add mockito |
c | coala-jetbrains | View | CodeAnalysisRunnerTest.java: Update test according to code changes |
c | coala-jetbrains | View | ProjectSettings.java: Rename section variable to be more descriptive |
c | coala-jetbrains | View | ProjectSettings.java: Make timeout value user configurable |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Refactor code |
c | coala-jetbrains | View | appveyor.yml: Add appveyor CI |
c | coala-jetbrains | View | CodeAnalysisRunnerTest.java: Fix paths on Windows and Unix |
c | coala-jetbrains | View | .travis.yml: Use openjdk instead of oraclejdk |
c | coala-jetbrains | View | .travis.yml: Add openjdk12 as testing environment |
c | coala-jetbrains | View | CodeAnalysisAction.java: Add basic logic to run coala from menu |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Log JSON output to IntelliJ Logs |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Add TODO task |
c | coala-jetbrains | View | .coafile: Change coala configuration |
c | coala-jetbrains | View | google_checks_coala.xml: Custom google checkstyle |
c | coala-jetbrains | View | intellij-java-google-style.xml: Add file |
c | coala-jetbrains | View | .gitignore: Add .iml files |
c | coala-jetbrains | View | Refactor ALL Files according to Google standards |
c | coala-jetbrains | View | Notifier.java: Create class for showing notifications |
c | coala-jetbrains | View | CodeAnalysisTask.java: Add error handling |
c | coala-jetbrains | View | Notifier.java: Update methods to be more complete and user friendly |
c | coala-jetbrains | View | Notifier.java, CodeAnalysisTask.java: Reformat Code |
c | coala-jetbrains | View | CodeAnalysisTask.java: Reformat code |
c | coala-jetbrains | View | Notifier.java: Reformat code |
c | coala-jetbrains | View | Notifier.java: Show user-friendly message instead of full stack-trace |
c | coala-jetbrains | View | CodeInspectionSeverity.java: Create enum for holding message severities |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Create class for holding coala console |
c | coala-jetbrains | View | CodeAnalysisToolWindowFactory.java: Create tool window |
c | coala-jetbrains | View | plugin.xml: Remove stray comments |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Reformat code |
c | coala-jetbrains | View | CodeAnalysisToolWindowFactory.java: Reformat code |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Add javadoc |
c | coala-jetbrains | View | ProjectSettings.java: Automatically detect coala executable |
c | coala-jetbrains | View | ProjectSettingsTest.java: Add tests for executable detection |
c | coala-jetbrains | View | ProjectSettings.java: Reformat code |
c | coala-jetbrains | View | ProjectSettingsTest.java: Reformat code |
c | coala-jetbrains | View | CodeAnalysisLog.java: Create class to hold log information |
c | coala-jetbrains | View | DeserializeLogFromJson.java: Parse Log JSON |
c | coala-jetbrains | View | CodeAnalysisLogDeserializer.java: Parse JSON and deserialize |
c | coala-jetbrains | View | CodeAnalysisLogDeserializerTest.java: Add tests |
c | coala-jetbrains | View | CodeInspectionSeverity.java: Add Verbose severity |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Implement verbose print method |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Add new text attribute for DEBUG |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Add method to clear console output |
c | coala-jetbrains | View | CodeAnalysisLog.java: Get severity tag |
c | coala-jetbrains | View | CodeAnalysisLogPrinter.java: Print logs to console |
c | coala-jetbrains | View | plugin.xml: Add CodeAnalysisLogPrinter as Project Component |
c | coala-jetbrains | View | CodeAnalysisTask.java: Parse logs from JSON |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Print log information to console |
c | coala-jetbrains | View | IssueManager.java: Add class to manage issues |
c | coala-jetbrains | View | IssueManager.java: Add methods to create range markers |
c | coala-jetbrains | View | IssueManager.java: Add method to get document |
c | coala-jetbrains | View | plugin.xml: Add IssueManager project component |
c | coala-jetbrains | View | HighlightIssue.java: Implement class for holding runtime highlight in… |
c | coala-jetbrains | View | HighlightIssue.java: Add method to get Text Range directly |
c | coala-jetbrains | View | HighlightIssueWrapper.java: Add a wrapper class |
c | coala-jetbrains | View | HighlightIssueWrapper.java: Add ability to store RangeHighlighters |
c | coala-jetbrains | View | HighlightIssueWrapper.java: Fix NPE |
c | coala-jetbrains | View | HighlightIssueFactory.java: Add class for holding wrapper information |
c | coala-jetbrains | View | HighlightIssueFactory.java: Implement method to populate map |
c | coala-jetbrains | View | HighlightIssueFactory.java: Add getter method |
c | coala-jetbrains | View | RangeMarkerTextAttributes.java: Add class for specifying TextAttributes |
c | coala-jetbrains | View | plugin.xml: Add RangeMarkerTextAttributes service |
c | coala-jetbrains | View | HighlightService.java: Application service to handle highlights |
c | coala-jetbrains | View | plugin.xml: Register HighlightService |
c | coala-jetbrains | View | HighlightService.java: Store newly created RangeMarkers in correspond… |
c | coala-jetbrains | View | IssueProcessor.java: Implement processor class |
c | coala-jetbrains | View | IssueProcessor.java: Add severity check |
c | coala-jetbrains | View | IssueProcessor.java: Implement method for creating tooltip |
c | coala-jetbrains | View | IssueProcessor.java: Refactor and clean code |
c | coala-jetbrains | View | CodeAnalysisTask.java: Run method to highlight in IDE |
c | coala-jetbrains | View | CodeAnalysisClearAction.java: Add clear all annotation action |
c | coala-jetbrains | View | HighlightService.java: Enhance the annotation remover to remove annot… |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Fix method name typo |
c | coala-jetbrains | View | CodeAnalysisConsoleView.java: Add Null checks |
c | coala-jetbrains | View | DeserializerTests: Restructure test folder layout |
c | coala-jetbrains | View | build.gradle: Update IntelliJ version |
c | coala-jetbrains | View | gradle-wrapper.properties: Update gradle version |
c | coala-jetbrains | View | CodeAnalysisMenu.java: Add coala menu group |
c | coala-jetbrains | View | plugin.xml: Add CodeAnalysisMenu as app component |
c | coala-jetbrains | View | NotifierTest.java: Add platform tests |
c | coala-jetbrains | View | Notifier.java: Add null check |
c | coala-jetbrains | View | ProjectSettingsTest.java: Change deprecated class |
c | coala-jetbrains | View | ApplicationSettings: Add settings page |
c | coala-jetbrains | View | CodeAnalysisSettingsPage.java: Rename |
c | coala-jetbrains | View | CodeAnalysisSettingsPage.java: Implement automatic detection of coala |
c | coala-jetbrains | View | CodeAnalysisSettingsPage.java: Add balloon popups |
c | coala-jetbrains | View | CodeAnalysisSettingsPersistent.java: Persist project settings |
c | coala-jetbrains | View | CodeAnalysisSettingsPage.java: Implement isModified logic |
c | coala-jetbrains | View | IssueManager.java: Add javadoc |
c | coala-jetbrains | View | IssueManager.java: Add javadoc |
c | coala-jetbrains | View | IssueManager.java: Add javadoc |
c | coala-jetbrains | View | IssueProcessor.java: Add javadoc and annotations |
c | coala-jetbrains | View | IssueProcessor.java: Modify method to iterate with keys |
c | coala-jetbrains | View | HighlightIssue.java: Add javadoc to constructors |
c | coala-jetbrains | View | HighlightService.java: getter for group id |
c | coala-jetbrains | View | HighlightService.java: Add javadoc for public methods |
c | coala-jetbrains | View | HighlightIssueFactory.java: Add javadoc |
c | coala-jetbrains | View | IssueManager.java: Refactor code |
c | coala-jetbrains | View | HighlightIssue.java: Refactor |
c | coala-jetbrains | View | HighlightIssueWrapper.java: Add javadoc |
c | coala-jetbrains | View | CodeAnalysisExecutor.java: Add method to save all files |
c | coala-jetbrains | View | CodeAnalysisAction.java: Change entry method |
c | coala-jetbrains | View | CodeAnalysisAction.java: Remove redundant executable setting |
c | coala-jetbrains | View | CodeAnalysisRunner.java: Add null check |
c | coala-jetbrains | View | CodeAnalysisTask.java: Catch FileNotFound exception |
c | coala-jetbrains | View | ProjectSettings.java: Remove automatic detection at instance creation |
c | coala-jetbrains | View | CodeAnalysisRunnerTest.java: Catch FileNotFound exception |
c | coala-jetbrains | View | Add GNU Affero General Public License v3.0 LICENSE |
c | coala-jetbrains | View | Update README |
c | coala-jetbrains | View | plugin.xml: Change plugin id |
c | coala-jetbrains | View | Make the plugin production ready by updating gradle build script |
c | coala-jetbrains | View | plugin.xml: Modify plugin description |
c | coala-jetbrains | View | README: Update steps to run |
c | coala-jetbrains | View | README: Add details about .coafile |
c | coala-jetbrains | View | Add run configuration for running the plugin |
c | coala-jetbrains | View | .gitignore: Add exception for Gradle run configurations |
c | coala-jetbrains | View | README.md: Add section with instructions to build the plugin |
c | coala-jetbrains | View | Deserializers: Migrate from gherkin to com.google.gson |
c | coala-jetbrains | View | ProjectSettings.java: Remove IOUtils |
c | coala-jetbrains | View | build.gradle: Release v0.1.1 |
c | coala-jetbrains | View | README.md: Update plugin name according to marketplace name |
c | coala-jetbrains | View | README.md: Add link to demonstration video |
The proposal was to create an robust and fully functional extension for coala CLI for Jetbrains IDEs that would provide a unified experience to the developers to analyze lint issues and fix code right within the IDE. And I am proud to say that coala now officially supports Jetbrains IDEs. In a nutshell, a single tap of a button would unleash coala and all of its friendly bears to help you find and annotate lint problems in the currently opened project.
Jetbrains Plugin Repository Link: https://plugins.jetbrains.com/plugin/12925-coala-code-analysis
Demonstration Video: https://youtu.be/a9iQzABYdJg
Let’s look at a few features of the plugin:
Analyze with coala menu entry is added to the Analyze Menu as well as right-click editor pop-up menu for faster invokation of coala.
Additionally Clear coala highlights menu entry has also been added for clearing highlights and getting on with the work.
Plugin is highly extensible via coala configuration file, viz, .coafile and has the ability to analyze all the files inside an IntelliJ project.
Settings page for plugin configuration has been implemented for setting of coala executable location.
The coala executable on Linux and Windows can automatically be detected if it is present in PATH. In case the executable is not present in PATH, the user can specify the location manually via the Settings menu.
The plugin itself is light-weight hence running coala on the project should not have an impact on the compute resources.
A console-like window is shown to the end-user during the execution of the plugin, for monitoring and analyzing ERROR and DEBUG information.
To facilitate a better UX, pop-up balloons and informative notifications have been implemented indicating the current events.
Progress bar showing the current progress and the item being processed is shown to the end-user.
Apart from the above mentioned plugin features, work was done on the overall framework aswell:
Continuous Integration is implemented for Multiple JDKs (OpenJDK 11 and 12) for Linux via Travis and Windows via Appveyor for catching code errors before they hit production.
Basic test suite based on JUnit and IntelliJ’s internal testing fixtures is implemented for more robustness.
Solving any computer science problem is challenging. This project was no different. I had no prior experience with IntelliJ Platform SDK OpenAPI. Developing a plugin for IntelliJ platform was a whole new experience for me.
Jetbrains has an awesome set of SDK docs for working with the DevKit but these docs are quite limited. I had to go through a bunch of already implemented plugins and the platform sources to understand the underlying basis and flow of a plugin, but this wasn’t quite enough. In the initial phase of the project I would find myself lurking on Jetbrains Gitter channel for finding answers. I would like to thank the entire Jetbrains community and especially Yann Cebron and Patrick Scheibe that helped me out whenever I got stuck.
The first of the roadblocks I hit was while working with the coala process. I had to find a way to create a coala process thread that must run synchronously in the background. The process would emit the data to its stdout and stderr which should be captured for further processing. Although the platform SDK had APIs to work with processes and their execution and also capturing the text emitted by the process, a lot of research had to be done to find the API and once found prototyping had to be done for implementing.
The process of showing logs to the user via a console was also challenging to implement. The ToolWindow
had to be created manually and a console attached to it during its initial set-up for it to work properly. Again, this wasn’t documented anywhere, hence a lot of research was done to make it work.
Another challenging part of working with command line processes inside Java was to determine how to run them asynchronously inside the IDE without impacting the performance.
But the main roadblock I faced was at the beginning of Phase 3. I had to find a way to process the data into Jetbrains friendly objects and finally annotate them. I had to research a lot on this topic, discussed about possible approaches on Gitter channel with fellow professionals, went through a bunch of similar plugins, prototyped a plethora of combinations, failed numerous times, until finally I hit the right solution. From that point it was just a matter of laying out the fundamental logic and implementing it.
These were some pretty challenging roadblocks that I faced, but I never lost hope. I was determined to find optimized solutions to these problems, and with consistency, hardwork and most importantly with the guidance of my mentors, I was able to overcome each and every challenge. I would especially like to thank Kilari Teja who constantly pushed me out of my comfort zone to make this project a success.
coala is a well-established CLI linter, with the ability for analyzing and fixing code for many languages. Being able to bring that power to the whole suite of IDEs proved to be a remarkable challenge. Overcoming these challenges, most of the proposed features have been implemented, yet the plugin is still in its early stages. More work needs to be done, to harness coala’s full power. Some of the features/optimizations that would make the plugin more feature-full and robust are:
Support for analyzing a single file or a set of files. Currently coala analyzes files as per .coafile settings.
Support for multiple error level highlight modes. coala supports 3 modes, INFO, WARNING, and ERROR.
Enhancements to the console-window for showing showing interactive buttons to Analyze current file, Analyze multiple files and Clearing the highlights etc.
Enhancements to the console-window to show a tree-view of all the problems that were detected by coala. The root being the file, containing multiple leaves representing the detected problems for a particular file.
Caching mechanism to support on the fly analysis. coala has a caching mechanism implemented in the main module. An extension of the same can be implemented for the plugin to support on-the-fly analysis so that actual calls to run coala CLI is reduced.
Optimizing the process of highlighting by just highlighting the currently opened files. The caching mechanism may be of help here.
Ability to fix code as per coala suggestions. coala emits a diff of a possible fix. This feature could be researched and used for the same.
A more integrated test suite with high coverage. IntelliJ recommends integrations tests and testing of the features as a whole. Apart from the integration tests, unit tests for fundamental class files can be implemented for better protection against breaking changes.
CI/CD pipeline for automatically publishing the plugin to Jetbrains repository.
Support for coala configuration file .coafile syntax.