Skip to content

Commit

Permalink
style: apply automated linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
megalinter-bot committed Oct 9, 2023
1 parent 4906226 commit 79a3526
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/language/validation/safe-ds-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ export const registerValidationChecks = function (services: SafeDsServices) {
namedTypeTypeArgumentListShouldBeNeeded,
],
SdsParameter: [parameterMustHaveTypeHint],
SdsParameterList: [
parameterListMustNotHaveRequiredParametersAfterOptionalParameters,
],
SdsParameterList: [parameterListMustNotHaveRequiredParametersAfterOptionalParameters],
SdsPipeline: [pipelineMustContainUniqueNames],
SdsPlaceholder: [placeholderShouldBeUsed(services)],
SdsReference: [
Expand Down
10 changes: 8 additions & 2 deletions tests/helpers/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ const getDiagnostics = async (services: LangiumServices, code: string): Promise<
* The code contains syntax errors.
*/
export class SyntaxErrorsInCodeError extends TestDescriptionError {
constructor(readonly syntaxErrors: Diagnostic[], uri: URI) {
constructor(
readonly syntaxErrors: Diagnostic[],
uri: URI,
) {
const syntaxErrorsAsString = syntaxErrors.map((e) => ` - ${e.message}`).join(`\n`);

super(`Code has syntax errors:\n${syntaxErrorsAsString}`, uri);
Expand All @@ -72,7 +75,10 @@ export class SyntaxErrorsInCodeError extends TestDescriptionError {
* The code contains syntax errors.
*/
export class ErrorsInCodeError extends TestDescriptionError {
constructor(readonly errors: Diagnostic[], uri: URI) {
constructor(
readonly errors: Diagnostic[],
uri: URI,
) {
const syntaxErrorsAsString = errors.map((e) => ` - ${e.message}`).join(`\n`);

super(`Code has errors:\n${syntaxErrorsAsString}`, uri);
Expand Down
12 changes: 6 additions & 6 deletions tests/helpers/testChecks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Location, Range} from 'vscode-languageserver';
import {findTestComments} from './testComments.js';
import {findTestRanges, FindTestRangesError} from './testRanges.js';
import {Result} from 'true-myth';
import {URI} from 'langium';
import {TestDescriptionError} from './testDescription.js';
import { Location, Range } from 'vscode-languageserver';
import { findTestComments } from './testComments.js';
import { findTestRanges, FindTestRangesError } from './testRanges.js';
import { Result } from 'true-myth';
import { URI } from 'langium';
import { TestDescriptionError } from './testDescription.js';

/**
* Finds all test checks, i.e. test comments and their corresponding test ranges.
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/testDescription.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {URI} from "langium";
import { URI } from 'langium';

/**
* A description of a test. This interface should be extended to describe tests of specific components.
Expand Down
14 changes: 10 additions & 4 deletions tests/language/validation/creator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { listSafeDsFilesGroupedByParentDirectory, uriToShortenedResourceName } from '../../helpers/testResources.js';
import fs from 'fs';
import { findTestChecks } from '../../helpers/testChecks.js';
import {getSyntaxErrors, SyntaxErrorsInCodeError} from '../../helpers/diagnostics.js';
import { getSyntaxErrors, SyntaxErrorsInCodeError } from '../../helpers/diagnostics.js';
import { EmptyFileSystem, URI } from 'langium';
import { createSafeDsServices } from '../../../src/language/safe-ds-module.js';
import { Range } from 'vscode-languageserver-types';
import {TestDescription, TestDescriptionError} from '../../helpers/testDescription.js';
import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
const rootResourceName = 'validation';
Expand Down Expand Up @@ -161,7 +161,10 @@ export type Severity = (typeof validSeverities)[number];
* A test comment did not match the expected format.
*/
class InvalidCommentError extends TestDescriptionError {
constructor(readonly comment: string, uri: URI) {
constructor(
readonly comment: string,
uri: URI,
) {
super(`Invalid test comment (refer to the documentation for guidance): ${comment}`, uri);
}
}
Expand All @@ -170,7 +173,10 @@ class InvalidCommentError extends TestDescriptionError {
* A test comment did not specify a valid severity.
*/
class InvalidSeverityError extends TestDescriptionError {
constructor(readonly type: string, uri: URI) {
constructor(
readonly type: string,
uri: URI,
) {
super(`Invalid severity (valid values are ${validSeverities.join(', ')}): ${type}`, uri);
}
}

0 comments on commit 79a3526

Please sign in to comment.