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 11, 2023
1 parent a268830 commit b95bfb7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/language/helpers/stringUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*/
export const pluralize = (count: number, singular: string, plural: string = `${singular}s`): string => {
return count === 1 ? singular : plural;
}
};
2 changes: 1 addition & 1 deletion src/language/validation/other/types/namedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const namedTypeTypeArgumentListMustNotHavePositionalArgumentsAfterNamedAr
export const namedTypeMustNotHaveTooManyTypeArguments = (node: SdsNamedType, accept: ValidationAcceptor): void => {
// If the declaration is unresolved, we already show another error
if (!node.declaration.ref) {
return
return;
}

const typeParameters = typeParametersOrEmpty(node.declaration.ref);
Expand Down
4 changes: 2 additions & 2 deletions src/language/validation/safe-ds-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ import { singleUseAnnotationsMustNotBeRepeated } from './builtins/repeatable.js'
import {
namedTypeMustNotHaveTooManyTypeArguments,
namedTypeMustNotSetTypeParameterMultipleTimes,
namedTypeTypeArgumentListMustNotHavePositionalArgumentsAfterNamedArguments
} from "./other/types/namedTypes.js";
namedTypeTypeArgumentListMustNotHavePositionalArgumentsAfterNamedArguments,
} from './other/types/namedTypes.js';

/**
* Register custom validation checks.
Expand Down
16 changes: 6 additions & 10 deletions src/language/validation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isSdsCallable, isSdsLambda, SdsAttribute, SdsNamedType, SdsParameter, S
import { typeArgumentsOrEmpty, typeParametersOrEmpty } from '../helpers/nodeProperties.js';
import { isEmpty } from 'radash';
import { SafeDsServices } from '../safe-ds-module.js';
import {pluralize} from "../helpers/stringUtils.js";
import { pluralize } from '../helpers/stringUtils.js';

export const CODE_TYPE_MISSING_TYPE_ARGUMENTS = 'type/missing-type-arguments';
export const CODE_TYPE_MISSING_TYPE_HINT = 'type/missing-type-hint';
Expand All @@ -30,15 +30,11 @@ export const namedTypeMustSetAllTypeParameters =
const kind = pluralize(missingTypeParameters.length, 'type parameter');
const missingTypeParametersString = missingTypeParameters.map((it) => `'${it.name}'`).join(', ');

accept(
'error',
`The ${kind} ${missingTypeParametersString} must be set here.`,
{
node,
property: 'typeArgumentList',
code: CODE_TYPE_MISSING_TYPE_ARGUMENTS,
},
);
accept('error', `The ${kind} ${missingTypeParametersString} must be set here.`, {
node,
property: 'typeArgumentList',
code: CODE_TYPE_MISSING_TYPE_ARGUMENTS,
});
}
} else {
accept(
Expand Down

0 comments on commit b95bfb7

Please sign in to comment.