All files / src/config linter.ts

41.17% Statements 21/51
100% Branches 2/2
18.18% Functions 2/11
41.17% Lines 21/51

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 522x 2x 2x 2x 2x 2x 2x 2x       2x       2x       2x       2x       2x       2x 15x 15x 15x 2x       2x       2x 2x              
import * as vscode from 'vscode';
 
const ROOT = 'vscode-code-reviewer';
 
export function getLinterForLanguage(language: string): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>(`linters.${language}`, '');
}
 
export function getPMDJarPath(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('pmd.jarPath', '');
}
 
export function getPMDRulesetPath(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('pmd.rulesetPath', '');
}
 
export function getPMDJspRulesetPath(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('pmd.jspRulesetPath', '');
}
 
export function getPMDAutoAuxClasspath(): boolean {
  return vscode.workspace.getConfiguration(ROOT).get<boolean>('pmd.autoAuxClasspath', true);
}
 
export function getSqlFluffConfigFile(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('sqlfluff.configFile', '');
}
 
export function getSqlFluffDialect(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('sqlfluff.dialect', '');
}
 
export function getEslintConfigPath(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('linters.eslintConfigPath', '');
}
 
export function getStylelintConfigPath(): string {
  return vscode.workspace.getConfiguration(ROOT).get<string>('linters.stylelintConfigPath', '');
}
 
export function isAdapterEnabled(adapterId: string): boolean {
  return vscode.workspace.getConfiguration(ROOT).get<boolean>(`linter.${adapterId}.enabled`, true);
}
 
export async function setAdapterEnabled(adapterId: string, enabled: boolean): Promise<void> {
  await vscode.workspace.getConfiguration(ROOT).update(
    `linter.${adapterId}.enabled`,
    enabled,
    vscode.ConfigurationTarget.Global
  );
}