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

Added encoding configuration #56

Closed
wants to merge 1 commit 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: 6 additions & 1 deletion phpcs-server/src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface PhpcsSettings {
ignorePatterns?: string[];
warningSeverity?: number;
errorSeverity?: number;
encoding?: string;
}

export interface PhpcsVersion {
Expand Down Expand Up @@ -314,7 +315,11 @@ export class PhpcsLinter {
if (this.version.major > 1
|| (this.version.major === 1 && this.version.minor >= 3)
) {
lintArgs.push('--encoding=UTF-8');
if(settings.encoding !== undefined) {
lintArgs.push(`--encoding=${settings.encoding}`);
} else {
lintArgs.push('--encoding=UTF-8');
}
}

if (settings.standard !== undefined) {
Expand Down
4 changes: 4 additions & 0 deletions phpcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ This setting controls the error severity level used by `phpcs`. You may specify
[ Optional | **Type:** `number` | **Default:** `null` ]
This setting controls the warning severity level used by `phpcs`. You may specify an integer value.

### **phpcs.encoding**

[ Optional | **Type:** `string` | **Default:** `null` ]
This setting controls the encoding used by `phpcs`. You may specify an string value.

## Acknowledgements

Expand Down
8 changes: 8 additions & 0 deletions phpcs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
],
"default": null,
"description": "Optional. Control the warning severity level."
},
"phpcs.encoding": {
"type": [
"string",
"null"
],
"default": null,
"description": "Optional. Control the enconding."
}
}
}
Expand Down