Skip to content

Commit

Permalink
Merge 2b3c881 into 73f2223
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Dec 24, 2019
2 parents 73f2223 + 2b3c881 commit e071612
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 104 deletions.
11 changes: 9 additions & 2 deletions packages/cspell-lib/samples/.cspell.json
Expand Up @@ -9,7 +9,8 @@
"words": [
"gensequence",
"xregexp",
"sampletrace"
"sampletrace",
"findall"
],
"maxNumberOfProblems": 10000,
"ignorePaths": [
Expand Down Expand Up @@ -61,6 +62,11 @@
"dictionaries": ["cpp"],
// Dictionary definitions can also be supplied here. They are only used iff "languageId" and "local" match.
"dictionaryDefinitions": []
},
{
// Turn off allowCompoundWords for Python
"languageId": "python",
"allowCompoundWords": false
}
],

Expand All @@ -76,7 +82,8 @@
"dictionaryDefinitions": [
{
"name": "cpp",
"path": "../dictionaries/companies.txt",
"path": "../dictionaries",
"file": "companies.txt",
"description": "C/C++ Keywords and common library functions."
}
]
Expand Down
98 changes: 0 additions & 98 deletions packages/cspell-lib/samples/sample.py

This file was deleted.

10 changes: 9 additions & 1 deletion packages/cspell-lib/samples/src/sample.py
@@ -1,4 +1,10 @@
"""Roman Numbers"""
"""
Roman Numbers
Sample Python file.
with email address: ExampleCode <possiblyhelpfulcodeexamples@code.example.com>
"""
import re

class OutOfRangeError(ValueError): pass
Expand Down Expand Up @@ -79,6 +85,8 @@ def to_number(roman):
value += romanNumeralValues[numeral]
return value

binary = b'binary'
unicode = u'unicode'

if __name__ == '__main__':
print(to_roman(1984))
Expand Down
1 change: 1 addition & 0 deletions packages/cspell-lib/src/Settings/DefaultSettings.ts
Expand Up @@ -10,6 +10,7 @@ import { mergeSettings } from './index';
const defaultRegExpExcludeList = [
'SpellCheckerDisable',
'Urls',
'Email',
'PublicKey',
'RsaCert',
'Base64',
Expand Down
6 changes: 4 additions & 2 deletions packages/cspell-lib/src/test/python.spec.ts
Expand Up @@ -4,7 +4,9 @@ import * as path from 'path';
import * as fsp from 'fs-extra';


const sampleFilename = path.join(__dirname, '..', '..', 'samples', 'src', 'sample.py');
const samples = path.join(__dirname, '..', '..', 'samples');
const sampleFilename = path.join(samples, 'src', 'sample.py');
const sampleConfig = path.join(samples, '.cspell.json');
const sampleFile = fsp.readFile(sampleFilename, 'UTF-8').then(buffer => buffer.toString());

describe('Validate that Python files are correctly checked.', () => {
Expand All @@ -14,7 +16,7 @@ describe('Validate that Python files are correctly checked.', () => {
expect(text).to.not.be.empty;
const ext = path.extname(sampleFilename);
const languageIds = cspell.getLanguagesForExt(ext);
const settings = cspell.getDefaultSettings();
const settings = cspell.mergeSettings(cspell.getDefaultSettings(), cspell.readSettings(sampleConfig));
const fileSettings = cspell.combineTextAndLanguageSettings(settings, text, languageIds);
return cspell.validateText(text, fileSettings)
.then(results => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell/src/application.test.ts
Expand Up @@ -115,7 +115,7 @@ function sampleTests(): SampleTest[] {
{ file: 'samples/src/sample.c', issues: [] },
{ file: 'samples/src/sample.go', issues: ['garbbage'] },
{ file: 'samples/src/sample.py', issues: ['garbbage'] },
{ file: 'samples/src/sample.tex', issues: ['hammersley', 'gmail', 'includegraphics', 'Zotero'] },
{ file: 'samples/src/sample.tex', issues: ['includegraphics', 'Zotero'] },
];
// cspell:enable
}
Expand Down

0 comments on commit e071612

Please sign in to comment.