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

Adds Java support #28

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SonarLint for Visual Studio Code

SonarLint is an IDE extension that helps you detect and fix quality issues as you write code. Like a spell checker, SonarLint squiggles flaws so they can be fixed before committing code. You can get it directly from the VS Code Marketplace and it will then detect new bugs and quality issues as you code (JavaScript, TypeScript, PHP and Python)
SonarLint is an IDE extension that helps you detect and fix quality issues as you write code. Like a spell checker, SonarLint squiggles flaws so they can be fixed before committing code. You can get it directly from the VS Code Marketplace and it will then detect new bugs and quality issues as you code (JavaScript, TypeScript, PHP, Python and Java)

## How it works

Simply open a JS, TS, Python or PHP file, start coding, and you will start seeing issues reported by SonarLint. Issues are highlighted in your code, and also listed in the 'Problems' panel.
Simply open a JS, TS, Python, PHP or Java file, start coding, and you will start seeing issues reported by SonarLint. Issues are highlighted in your code, and also listed in the 'Problems' panel.

![sonarlint on-the-fly](images/sonarlint-vscode.gif)

Expand All @@ -20,8 +20,9 @@ Check the rules to see what SonarLint can do for you:
- [TypeScript rules](https://rules.sonarsource.com/typescript)
- [Python rules](https://rules.sonarsource.com/python)
- [PHP rules](https://rules.sonarsource.com/php)
- [Java rules](https://rules.sonarsource.com/java)

You will benefit from the following code analyzers: [SonarJS](https://redirect.sonarsource.com/plugins/javascript.html), [SonarTS](https://redirect.sonarsource.com/plugins/typescript.html), [SonarPython](https://redirect.sonarsource.com/plugins/python.html) and [SonarPHP](https://redirect.sonarsource.com/plugins/php.html)
You will benefit from the following code analyzers: [SonarJS](https://redirect.sonarsource.com/plugins/javascript.html), [SonarTS](https://redirect.sonarsource.com/plugins/typescript.html), [SonarPython](https://redirect.sonarsource.com/plugins/python.html), [SonarPHP](https://redirect.sonarsource.com/plugins/php.html) and [SonarJava](https://redirect.sonarsource.com/plugins/java.html)

## Requirements

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonarlint-vscode",
"displayName": "SonarLint",
"description": "SonarLint is an IDE extension that helps you detect and fix quality issues as you write code in JavaScript, TypeScript, Python and PHP.",
"description": "SonarLint is an IDE extension that helps you detect and fix quality issues as you write code in JavaScript, TypeScript, Python, Java and PHP.",
"version": "1.6.0-SNAPSHOT",
"icon": "images/sonarlint_wave_128px.png",
"publisher": "SonarSource",
Expand Down Expand Up @@ -32,7 +32,8 @@
"onLanguage:typescriptreact",
"onLanguage:python",
"onLanguage:php",
"onLanguage:vue"
"onLanguage:vue",
"onLanguage:java"
],
"extensionDependency": [
"typescript"
Expand Down
5 changes: 5 additions & 0 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const sonarJsVersion = '4.2.0.6476';
const sonarPhpVersion = '2.14.0.3569';
const sonarPythonVersion = '1.10.0.2131';
const sonarTsVersion = '1.7.0.2893';
const sonarJavaVersion = '5.5.0.14655';

if (!fs.existsSync('server')) {
fs.mkdirSync('server');
Expand All @@ -21,6 +22,10 @@ downloadIfNeeded(
`https://repox.sonarsource.com/sonarsource/org/sonarsource/sonarlint/core/sonarlint-language-server/${languageServerVersion}/sonarlint-language-server-${languageServerVersion}.jar`,
'server/sonarlint-ls.jar'
);
downloadIfNeeded(
`https://repo1.maven.org/maven2/org/sonarsource/java/sonar-java-plugin/${sonarJavaVersion}/sonar-java-plugin-${sonarJavaVersion}.jar`,
"analyzers/sonarjava.jar"
);
downloadIfNeeded(
`https://repox.sonarsource.com/sonarsource/org/sonarsource/javascript/sonar-javascript-plugin/${sonarJsVersion}/sonar-javascript-plugin-${sonarJsVersion}.jar`,
'analyzers/sonarjs.jar'
Expand Down
14 changes: 8 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function languageServerCommand(
params.push(toUrl(Path.resolve(context.extensionPath, 'analyzers', 'sonarjs.jar')));
params.push(toUrl(Path.resolve(context.extensionPath, 'analyzers', 'sonarphp.jar')));
params.push(toUrl(Path.resolve(context.extensionPath, 'analyzers', 'sonarpython.jar')));
params.push(toUrl(Path.resolve(context.extensionPath, 'analyzers', 'sonarjava.jar')));
params.push(toUrl(Path.resolve(context.extensionPath, 'analyzers', 'sonarts.jar')));
return { command: javaExecutablePath, args: params };
}
Expand Down Expand Up @@ -172,7 +173,8 @@ export function activate(context: VSCode.ExtensionContext) {
'python',
'typescript',
'typescriptreact',
'vue'
'vue',
'java'
],
synchronize: {
configurationSection: 'sonarlint'
Expand Down Expand Up @@ -342,15 +344,15 @@ function computeRuleDescPanelContent(
return `<!doctype html><html>
<head>
<style type="text/css">
body {
font-family: Helvetica Neue,Segoe UI,Helvetica,Arial,sans-serif;
font-size: 13px; line-height: 1.23076923;
body {
font-family: Helvetica Neue,Segoe UI,Helvetica,Arial,sans-serif;
font-size: 13px; line-height: 1.23076923;
}

h1 { font-size: 14px;font-weight: 500; }
h2 { line-height: 24px;}
a { border-bottom: 1px solid rgba(230, 230, 230, .1); color: #236a97; cursor: pointer; outline: none; text-decoration: none; transition: all .2s ease;}

.rule-desc { line-height: 1.5;}
.rule-desc { line-height: 1.5;}
.rule-desc h2 { font-size: 16px; font-weight: 400;}
Expand Down