diff --git a/README.md b/README.md index 9c8d622e..772c5d97 100644 --- a/README.md +++ b/README.md @@ -91,20 +91,24 @@ If you encounter this issue while having installed the correct version of node o ## How to use it? -* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) +* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) -## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` +## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` Generate the sfdx content in source format and destructive change from two git commits ``` USAGE $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] - [-o ] [-a ] [-d] [--json] [--loglevel + [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS - -D, --ignore-destructive=ignore-destructive ignore file to use + -D, --ignore-destructive=ignore-destructive file listing paths to explicitly + ignore for any destructive actions + + -N, --include-destructive=include-destructive file listing paths to explicitly + include for any destructive actions -W, --ignore-whitespace ignore git diff whitespace (space, tab, eol) changes @@ -118,7 +122,11 @@ OPTIONS diff is done [git rev-list --max-parents=0 HEAD] - -i, --ignore=ignore ignore file to use + -i, --ignore=ignore file listing paths to explicitly + ignore for any diff actions + + -n, --include=include file listing paths to explicitly + include for any diff actions -o, --output=output [default: ./output] source package specific output @@ -286,7 +294,7 @@ and will not be used to add member in `package.xml` nor `destructiveChanges.xml` But, sometimes you may need to have two different ignore policies for generating the `package.xml` and `destructiveChanges.xml` files. This is where the `--ignore-destructive [-D]` option comes handy! -Use the `--ignore-destructive` parameter to specify a dedicated ignore file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). In orther words, this will override the `--ignore [-i]` parameter for deleted items. +Use the `--ignore-destructive` parameter to specify a dedicated ignore file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). In other words, this will override the `--ignore [-i]` parameter for deleted items. For example, consider a repository containing multiple sub-folders (force-app/main,force-app/sample, etc) and a commit deleting the Custom\_\_c object from one folder and modifying the Custom\_\_c object from another folder. This event will be treated has a Modification and a Deletion. By default, the Custom\_\_c object would appear in the `package.xml` and in `destructiveChanges.xml`, which could be a little bit inconsistent and can break the CI/CD build. This is a situation where your may want to use the `--ignore-destructive [-D]` parameter! Add the Custom\_\_c object pattern in an ignore file and pass it in the CLI parameter: @@ -300,6 +308,24 @@ $ sfdx sgd:source:delta --from commit --ignore-destructive destructiveignore Note that in a situation where only the `--ignore [-i]` parameter is specified (and `--ignore-destructive [-D]` is not specified), then the plugin will ignore items matching `--ignore [-i]` parameter in all situations: Addition, Modification and Deletion. +### Explicitly including specific files for inclusion or destruction regardless of diff: + +The `--include [-n]` parameter allows you to specify a file based on [micromatch glob matching](https://github.com/micromatch/micromatch) used to explicitly include the specific files, regardless whether they have diffed or not. Similar to the `--ignore` flag, this file defines a list of glob file matchers to indicate which `git` aware files should always be included in the `package.xml` package. Every matching the pattern from the include file specified in the `--include [-n]` will be included by SGD. + +As with `--ignore`, sometimes you may need to have two different include policies for generating the `package.xml` and `destructiveChanges.xml` files. This is where the `--include-destructive [-N]` option comes handy! + +Use the `--include-destructive` parameter to specify a dedicated include file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). Here, you will indicate which files explicitly should be included in the `destructiveChanges.xml`. + +For example, consider a repository containing multiple sub-folders (force-app/main,force-app/sample, etc) and the CI/CD platform generates a new file `force-app/generated/foo` that should not be included in the `source:deploy` command. You can create a file with a line matching this new file and specify this file using the `--include-destructive [-N]` parameter. + +```sh +# destructiveinclude +*generated/foo + +$ sfdx sgd:source:delta --from commit --include-destructive destructiveinclude + +``` + ### Scoping delta generation to a specific folder The `--source [-s]`parameter allows you to specify a folder to focus on, making any other folder ignored. @@ -373,6 +399,7 @@ console.log(JSON.stringify(work)) - [fs-extra](https://github.com/jprichardson/node-fs-extra) - Node.js: extra methods for the fs object like copy(), remove(), mkdirs(). - [ignore](https://github.com/kaelzhang/node-ignore#readme) - is a manager, filter and parser which implemented in pure JavaScript according to the .gitignore spec 2.22.1. - [xmlbuilder](https://github.com/oozcitak/xmlbuilder-js) - An XML builder for node.js similar to java-xmlbuilder. +- [micromatch](https://github.com/micromatch/micromatch) - a file glob matcher utility ## Versioning diff --git a/__mocks__/.forceinclude b/__mocks__/.forceinclude new file mode 100644 index 00000000..4d6e3c0f --- /dev/null +++ b/__mocks__/.forceinclude @@ -0,0 +1 @@ +**/jsconfig.json \ No newline at end of file diff --git a/__mocks__/fs.js b/__mocks__/fs.js index ea534ecf..481f341b 100644 --- a/__mocks__/fs.js +++ b/__mocks__/fs.js @@ -27,6 +27,9 @@ fs.statSync = elem => ({ isDirectory() { return elem !== 'file' }, + isFile() { + return filePathList.has(elem) + }, }) fs.readFileSync = path => { diff --git a/__tests__/integration/main.test.js b/__tests__/integration/main.test.js index 13946647..46157711 100644 --- a/__tests__/integration/main.test.js +++ b/__tests__/integration/main.test.js @@ -27,6 +27,8 @@ describe(`test if the appli`, () => { fsMocked.__setMockFiles({ output: '', '.': '', + '.forceignore': '', + '.forceinclude': '', }) child_process.spawnSync.mockImplementation(() => ({ stdout: '' })) }) @@ -53,6 +55,7 @@ describe(`test if the appli`, () => { ...testConfig, ignore: '.forceignore', ignoreDestructive: '.forceignore', + include: '.forceinclude', }) ).toHaveProperty('warnings', []) }) diff --git a/__tests__/unit/lib/utils/cliHelper.test.js b/__tests__/unit/lib/utils/cliHelper.test.js index bf23e74d..a848ffd7 100644 --- a/__tests__/unit/lib/utils/cliHelper.test.js +++ b/__tests__/unit/lib/utils/cliHelper.test.js @@ -74,6 +74,46 @@ describe(`test if the appli`, () => { }).toThrow() }) + test('throw errors when file is not found for --ignore', () => { + cliHelper = new CLIHelper({ + ...testConfig, + ignore: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --ignore-destructive', () => { + cliHelper = new CLIHelper({ + ...testConfig, + ignoreDestructive: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --include', () => { + cliHelper = new CLIHelper({ + ...testConfig, + include: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --include-destructive', () => { + cliHelper = new CLIHelper({ + ...testConfig, + includeDestructive: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + test('throw errors when "-t" and "-d" are set', () => { const notHeadSHA = 'test' child_process.spawnSync diff --git a/__tests__/unit/lib/utils/repoGitDiff.test.js b/__tests__/unit/lib/utils/repoGitDiff.test.js index 9b4a4b87..d69dc567 100644 --- a/__tests__/unit/lib/utils/repoGitDiff.test.js +++ b/__tests__/unit/lib/utils/repoGitDiff.test.js @@ -6,6 +6,7 @@ jest.mock('child_process', () => ({ spawnSync: jest.fn() })) jest.mock('fs-extra') const FORCEIGNORE_MOCK_PATH = '__mocks__/.forceignore' +const FORCEINCLUDE_MOCK_PATH = '__mocks__/.forceinclude' describe(`test if repoGitDiff`, () => { test('can parse git correctly', () => { @@ -18,7 +19,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -37,7 +38,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -53,7 +54,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toMatchObject(output) }) @@ -69,7 +70,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -85,7 +86,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -99,7 +100,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -115,7 +116,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -139,7 +140,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -155,7 +156,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -171,7 +172,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -185,7 +186,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -204,7 +205,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() const expected = [output[1]] expect(work).toStrictEqual(expected) }) @@ -222,7 +223,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() const expected = [output[1]] expect(work).toStrictEqual(expected) }) @@ -240,7 +241,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -257,10 +258,102 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) + test('can explicitly include files', () => { + const output = ['force-app/main/default/lwc/jsconfig.json'] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output[0], + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + include: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = ['A force-app/main/default/lwc/jsconfig.json'] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include destructive files', () => { + const output = ['force-app/main/default/lwc/jsconfig.json'] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output[0], + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + includeDestructive: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = ['D force-app/main/default/lwc/jsconfig.json'] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include multiple files', () => { + const output = [ + 'force-app/main/default/lwc/jsconfig.json', + 'force-app/main/default/staticresources/jsconfig.json', + ] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output.join(os.EOL), + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + include: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = [ + 'A force-app/main/default/lwc/jsconfig.json', + 'A force-app/main/default/staticresources/jsconfig.json', + ] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include destructive multiple files', () => { + const output = [ + 'force-app/main/default/lwc/jsconfig.json', + 'force-app/main/default/staticresources/jsconfig.json', + ] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output.join(os.EOL), + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + includeDestructive: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = [ + 'D force-app/main/default/lwc/jsconfig.json', + 'D force-app/main/default/staticresources/jsconfig.json', + ] + expect(work).toStrictEqual(expected) + }) + test('can reject in case of error', () => { const expected = new Error('Test Error') child_process.spawnSync.mockImplementation(() => { @@ -268,7 +361,7 @@ describe(`test if repoGitDiff`, () => { }) try { const repoGitDiff = new RepoGitDiff({ output: '', repo: '' }, null) - repoGitDiff.getDiff() + repoGitDiff.getFilteredDiff() } catch (e) { expect(e).toBe(expected) } diff --git a/bin/cli b/bin/cli index 14112aec..297d47cd 100644 --- a/bin/cli +++ b/bin/cli @@ -32,6 +32,8 @@ const options = program ) .option('-r, --repo [dir]', messages.repoFlag, CliHelper.REPO_DEFAULT_VALUE) .option('-d, --generate-delta', messages.deltaFlag) + .option('-n, --include', messages.includeFlag) + .option('-N, --include-destructive', messages.includeDestructiveFlag) .parse(process.argv) .opts() diff --git a/messages/delta.js b/messages/delta.js index 31b2402c..a5d82abf 100644 --- a/messages/delta.js +++ b/messages/delta.js @@ -7,9 +7,13 @@ module.exports = { repoFlag: 'git repository location', outputFlag: 'source package specific output', sourceFlag: 'source folder focus location related to --repo', - ignoreFlag: 'ignore file to use', - ignoreDestructiveFlag: 'ignore file to use', + ignoreFlag: 'file listing paths to explicitly ignore for any diff actions', + ignoreDestructiveFlag: + 'file listing paths to explicitly ignore for any destructive actions', apiVersionFlag: 'salesforce API version', deltaFlag: 'generate delta files in [--output] folder', ignoreWhitespaceFlag: 'ignore git diff whitespace (space, tab, eol) changes', + includeFlag: 'file listing paths to explicitly include for any diff actions', + includeDestructiveFlag: + 'file listing paths to explicitly include for any destructive actions', } diff --git a/package.json b/package.json index 256a99a9..04743127 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "fs-extra": "^10.0.0", "git-state": "^4.1.0", "ignore": "^5.1.8", + "micromatch": "^4.0.4", "tslib": "^2.3.1", "xmlbuilder": "^15.1.1" }, @@ -79,6 +80,7 @@ "@types/node": "^16.10.3", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", + "codeclimate": "^0.0.32", "conventional-github-releaser": "^3.1.5", "eslint": "^8.0.0", "eslint-config-prettier": "^8.3.0", diff --git a/src/commands/sgd/source/delta.ts b/src/commands/sgd/source/delta.ts index bc0c7e4f..d997e836 100644 --- a/src/commands/sgd/source/delta.ts +++ b/src/commands/sgd/source/delta.ts @@ -63,6 +63,14 @@ export default class SourceDeltaGenerate extends SfdxCommand { char: 'd', description: messages.getMessage('deltaFlag'), }), + include: flags.filepath({ + char: 'n', + description: messages.getMessage('includeFlag'), + }), + 'include-destructive': flags.filepath({ + char: 'N', + description: messages.getMessage('includeDestructiveFlag'), + }), } public async run(): Promise { @@ -84,6 +92,8 @@ export default class SourceDeltaGenerate extends SfdxCommand { repo: this.flags.repo, ignoreWhitespace: this.flags['ignore-whitespace'], generateDelta: this.flags['generate-delta'], + include: this.flags.include, + includeDestructive: this.flags['include-destructive'], }) output.warnings = jobResult?.warnings?.map(warning => warning.message) } catch (err) { diff --git a/src/main.js b/src/main.js index f82038a0..22c0452e 100644 --- a/src/main.js +++ b/src/main.js @@ -22,7 +22,9 @@ module.exports = config => { ) const repoGitDiffHelper = new RepoGitDiff(config, metadata) - const lines = repoGitDiffHelper.getDiff(config, metadata) + const filteredLines = repoGitDiffHelper.getFilteredDiff() + const includedLines = repoGitDiffHelper.getIncludedFiles() + const lines = [...filteredLines, ...includedLines] const work = treatDiff(config, lines, metadata) treatPackages(work.diffs, config, metadata) return work diff --git a/src/utils/cliHelper.js b/src/utils/cliHelper.js index f3c62115..cb2f9a62 100644 --- a/src/utils/cliHelper.js +++ b/src/utils/cliHelper.js @@ -6,6 +6,7 @@ const fs = require('fs') const git = require('git-state') const dirExist = dir => fs.existsSync(dir) && fs.statSync(dir).isDirectory() +const fileExist = file => fs.statSync(file).isFile() class CLIHelper { constructor(config) { @@ -25,6 +26,14 @@ class CLIHelper { ;[this.config.output, this.config.source] .filter(dir => !dirExist(dir)) .forEach(dir => errors.push(`${dir} folder does not exist`)) + ;[ + this.config.ignore, + this.config.ignoreDestructive, + this.config.include, + this.config.includeDestructive, + ] + .filter(file => file && !fileExist(file)) + .forEach(file => errors.push(`${file} file does not exist`)) if (!git.isGitSync(this.config.repo)) { errors.push(`${this.config.repo} is not a git repository`) @@ -37,7 +46,7 @@ class CLIHelper { } if (errors.length > 0) { - throw new Error(errors) + throw new Error(errors.join(', ')) } this.repoSetup.repoConfiguration() @@ -51,6 +60,10 @@ class CLIHelper { this.config.ignore = sanitizePath(this.config.ignore) this.config.ignoreDestructive = sanitizePath(this.config.ignoreDestructive) this.config.from = this.repoSetup.computeFromRef() + this.config.include = sanitizePath(this.config.include) + this.config.includeDestructive = sanitizePath( + this.config.includeDestructive + ) } static TO_DEFAULT_VALUE = 'HEAD' diff --git a/src/utils/repoGitDiff.js b/src/utils/repoGitDiff.js index 697afb40..701ea573 100644 --- a/src/utils/repoGitDiff.js +++ b/src/utils/repoGitDiff.js @@ -8,10 +8,13 @@ const gc = require('./gitConstants') const childProcess = require('child_process') const fs = require('fs') const ignore = require('ignore') +const micromatch = require('micromatch') + const os = require('os') const path = require('path') const fullDiffParams = ['--no-pager', 'diff', '--name-status', '--no-renames'] +const allFilesParams = ['ls-files'] const lcSensitivity = { sensitivity: 'accent', } @@ -27,7 +30,15 @@ class RepoGitDiff { this.metadata = metadata } - getDiff() { + getIncludedFiles() { + const { stdout: ls } = childProcess.spawnSync('git', [...allFilesParams], { + cwd: this.config.repo, + encoding: gc.UTF8_ENCODING, + }) + return this._addIncludes(cpUtils.treatDataFromSpawn(ls)) + } + + getFilteredDiff() { const ignoreWhitespaceParams = this.config.ignoreWhitespace ? gc.IGNORE_WHITESPACE_PARAMS : [] @@ -76,12 +87,30 @@ class RepoGitDiff { ) } + _addIncludes(lines) { + return [ + { include: this.config.include, prefix: 'A' }, + { include: this.config.includeDestructive, prefix: 'D' }, + ].flatMap(obj => { + return obj.include + ? micromatch( + lines.split(os.EOL), + fs + .readFileSync(obj.include) + .toString() + .split(os.EOL) + .filter(i => i) + ).map(include => `${obj.prefix} ${include}`) + : [] + }) + } + _filterIgnore(line) { - const ig = ignore() - const dig = ignore() + const fileIgnorer = ignore() + const fileDestIgnorer = ignore() ;[ - { ignore: this.config.ignore, helper: ig }, - { ignore: this.config.ignoreDestructive, helper: dig }, + { ignore: this.config.ignore, helper: fileIgnorer }, + { ignore: this.config.ignoreDestructive, helper: fileDestIgnorer }, ].forEach( ign => ign.ignore && @@ -90,9 +119,9 @@ class RepoGitDiff { ) return this.config.ignoreDestructive ? line.startsWith(gc.DELETION) - ? !dig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) - : !ig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) - : !ig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + ? !fileDestIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + : !fileIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + : !fileIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) } _extractComparisonName(line) { diff --git a/yarn.lock b/yarn.lock index 3a52cc43..1533ea02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2025,6 +2025,11 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= +codeclimate@^0.0.32: + version "0.0.32" + resolved "https://registry.yarnpkg.com/codeclimate/-/codeclimate-0.0.32.tgz#3e8fab6e59debb64c71bb899fceff7f1a829cb8a" + integrity sha1-Po+rblneu2THG7iZ/O/38agpy4o= + coffeescript@^1.10.0: version "1.12.7" resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-1.12.7.tgz#e57ee4c4867cf7f606bfc4a0f2d550c0981ddd27"