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

Suppress warning implementation from global settings #49

Merged
merged 9 commits into from
Jun 19, 2024

Conversation

dariowskii
Copy link
Contributor

@dariowskii dariowskii commented May 24, 2024

Fixes #48

You can suppress specific warnings (or all) by setting this values in settings.json:

"arbEditor.suppressedWarnings": <value> // "all" or [0, 1, ..., 9]

It's a good idea to open an issue first for discussion.

  • Implemented new tests
  • Tests pass
  • Appropriate changes to README are included in PR

@mosuem
Copy link
Collaborator

mosuem commented May 24, 2024

Thanks for the PR!

Although I suspect that dismissing warnings has usually some other bug at its root, which we should fix, it's still a good functionality to have. Unfortunately the CI seems to be broken, I will look into that!

@dariowskii
Copy link
Contributor Author

Hi @mosuem,

Yes I agree, eliminating warnings can lead to bugs but in the end it is defined by the user, so it seems more like a calculated risk to me.

The reason that pushed me to create this PR is that I started defining my arb file like this:

{
     "@@locale": "en",

     "@_COMMON": {},
     "warning": "Warning",
     "error": "Error",
     "loading": "Loading",
     "close": "Close",
     "cancel": "Cancel",
     "done": "Done",

     "@_LOGIN_PAGE": {},
     "loginTitle": "Login Page"
}

Right now, @_COMMON and @_LOGIN_PAGE are diagnosed as errors and all the keys have warnings because they do not have the metadata defined (which in my opinion are not needed for simple and self-explanatory keys).
Having the possibility of eliminating some warnings without losing the other features offered by the plugin would be really convenient, and would also simplify reading the diagnosis tab!

(Anyway, really a strange behavior of CI 😅)

src/diagnose.ts Outdated Show resolved Hide resolved
@dariowskii
Copy link
Contributor Author

Hi @mosuem,

I pushed the update but noticed that the tests for quickfixes are not consistent. Testing locally I was able to notice that these (even without the integration of this PR) can arbitrarily fail or succeed.
I don't know if it depends on my computer or if there is something broken in the tests but I think they need to be revised.

@mosuem
Copy link
Collaborator

mosuem commented May 29, 2024

Testing locally I was able to notice that these (even without the integration of this PR) can arbitrarily fail or succeed.

That's not good :) Do you have any logs or similar which could help debugging this?

Copy link
Collaborator

@mosuem mosuem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (just a nit remaining, if you want to address that).

src/diagnose.ts Show resolved Hide resolved
@dariowskii
Copy link
Contributor Author

dariowskii commented May 29, 2024

Testing locally I was able to notice that these (even without the integration of this PR) can arbitrarily fail or succeed.

That's not good :) Do you have any logs or similar which could help debugging this?

@mosuem Yes, I do. This is one log

    ✔ A rough parser test, as the real test will be done by the golden.
extensionHostProcess.js:147
    ✔ Test quickfix for missing Metadata (108ms)
extensionHostProcess.js:147
    1) Test quickfix for placeholder without metadata with tabs
extensionHostProcess.js:147
    ✔ Test quickfix for placeholder without metadata with spaces (110ms)
extensionHostProcess.js:147
    ✔ Test finding unescaped regions
extensionHostProcess.js:147
    ✔ Test suppressed all warnings (72ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with id missing_metadata_for_key (132ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with id 'invalid_key', 'missing_metadata_for_key' (47ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with code 'metadata_for_missing_key' (69ms)
extensionHostProcess.js:147
  10 passing (2s)
extensionHostProcess.js:147
  1 failing
extensionHostProcess.js:147
  1) Extension Test Suite
       Test quickfix for placeholder without metadata with tabs:
     Canceled
   Canceled
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:99:13540)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.z (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:730)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:946)
      at R.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:5051)
      at N.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:5461)
      at Object.Z (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:4340)
      at c.N (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:4817)
      at c.L (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:3674)
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:2227)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:877)
      at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:14175)
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:176:8023)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:877)
      at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:14175)
      at MessagePortMain.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:176:6303)
      at MessagePortMain.emit (node:events:517:28)
      at Object.MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2285)
      at Object.callbackTrampoline (node:internal/async_hooks:130:17)

extensionHostProcess.js:147
Error: 1 tests failed.
    at /Users/dariovarriale/Desktop/me/my_github/arb-editor/src/test/suite/index.ts:40:9
    at done (/Users/dariovarriale/Desktop/me/my_github/arb-editor/node_modules/mocha/lib/mocha.js:1012:7)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Extension Test Suite
extensionHostProcess.js:147
    ✔ Decorate golden file. (340ms)
extensionHostProcess.js:147
    ✔ Decorate golden file with template. (259ms)
extensionHostProcess.js:147
    ✔ A rough parser test, as the real test will be done by the golden.
extensionHostProcess.js:147
    ✔ Test quickfix for missing Metadata (120ms)
extensionHostProcess.js:147
    1) Test quickfix for placeholder without metadata with tabs
extensionHostProcess.js:147
    ✔ Test quickfix for placeholder without metadata with spaces (72ms)
extensionHostProcess.js:147
    ✔ Test finding unescaped regions (107ms)
extensionHostProcess.js:147
    ✔ Test suppressed all warnings
extensionHostProcess.js:147
    ✔ Test suppressed warning with id missing_metadata_for_key (62ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with id 'invalid_key', 'missing_metadata_for_key' (45ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with code 'metadata_for_missing_key' (40ms)
extensionHostProcess.js:147
  10 passing (1s)
extensionHostProcess.js:147
  1 failing
  1) Extension Test Suite
       Test quickfix for placeholder without metadata with tabs:

      AssertionError [ERR_ASSERTION]: '{\n' +
  '\t"@@locale": "en",\n' +
  '\t"helloAndWelcome2": "Welcome {firstName}!",\n' +
  '\t"@helloAndWelcome2": {}\n' +
  '}' == '{\n' +
  '\t"@@locale": "en",\n' +
  '\t"helloAndWelcome2": "Welcome {firstName}!",\n' +
  '\t"@helloAndWelcome2": {\n' +
  '\t\t"placeholders": {\n' +
  '\t\t\t"firstName": {}\n' +
  '\t\t}\n' +
  '\t}\n' +
  '}'
      + expected - actual

       {
--
       	"helloAndWelcome2": "Welcome {firstName}!",
      -	"@helloAndWelcome2": {}
      +	"@helloAndWelcome2": {
      +		"placeholders": {
      +			"firstName": {}
      +		}
      +	}
       }
      
  	at compareGolden (/Users/dariovarriale/Desktop/me/my_github/arb-editor/out/test/suite/extension.test.js:159:16)
  	at async testFixAgainstGolden (/Users/dariovarriale/Desktop/me/my_github/arb-editor/out/test/suite/extension.test.js:147:5)
  	at async Context.<anonymous> (/Users/dariovarriale/Desktop/me/my_github/arb-editor/out/test/suite/extension.test.js:82:9)

extensionHostProcess.js:147
Error: 1 tests failed.
	at /Users/dariovarriale/Desktop/me/my_github/arb-editor/out/test/suite/index.js:35:27
	at done (/Users/dariovarriale/Desktop/me/my_github/arb-editor/node_modules/mocha/lib/mocha.js:1012:7)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

That's another one

    ✔ A rough parser test, as the real test will be done by the golden. (136ms)
extensionHostProcess.js:147
    1) Test quickfix for missing Metadata
extensionHostProcess.js:147
    ✔ Test quickfix for placeholder without metadata with tabs (154ms)
extensionHostProcess.js:147
    ✔ Test quickfix for placeholder without metadata with spaces (84ms)
extensionHostProcess.js:147
    ✔ Test finding unescaped regions
extensionHostProcess.js:147
    ✔ Test suppressed all warnings (45ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with id missing_metadata_for_key (70ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with id 'invalid_key', 'missing_metadata_for_key' (64ms)
extensionHostProcess.js:147
    ✔ Test suppressed warning with code 'metadata_for_missing_key' (49ms)
extensionHostProcess.js:147
  10 passing (2s)
extensionHostProcess.js:147
  1 failing
extensionHostProcess.js:147
  1) Extension Test Suite
       Test quickfix for missing Metadata:
     Canceled
   Canceled
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:99:13540)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.z (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:730)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:946)
      at R.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:5051)
      at N.cancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:5461)
      at Object.Z (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:4340)
      at c.N (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:4817)
      at c.L (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:3674)
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:2227)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:877)
      at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:14175)
      at a.value (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:176:8023)
      at o.y (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:660)
      at o.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:82:877)
      at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:107:14175)
      at MessagePortMain.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:176:6303)
      at MessagePortMain.emit (node:events:517:28)
      at Object.MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2285)
      at Object.callbackTrampoline (node:internal/async_hooks:130:17)

extensionHostProcess.js:147
Error: 1 tests failed.
    at /Users/dariovarriale/Desktop/me/my_github/arb-editor/src/test/suite/index.ts:40:9
    at done (/Users/dariovarriale/Desktop/me/my_github/arb-editor/node_modules/mocha/lib/mocha.js:1012:7)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

I also tried running the tests by disabling the extensions but the result is the same. Sometimes they all pass without problems, sometimes some tests for quickfixes fail or are canceled

@dariowskii
Copy link
Contributor Author

Hi @mosuem, are there any updates?

@mosuem mosuem mentioned this pull request Jun 10, 2024
@mosuem
Copy link
Collaborator

mosuem commented Jun 17, 2024

@dariowskii there is some test failure, if that is unrelated or fixed this is ready to merge.

@dariowskii
Copy link
Contributor Author

@dariowskii there is some test failure, if that is unrelated or fixed this is ready to merge.

@mosuem I checked the test, I confirm that it is not related to the feature implemented in this PR 👍🏻

@mosuem mosuem merged commit 9dd53e5 into google:main Jun 19, 2024
4 checks passed
@dariowskii
Copy link
Contributor Author

Hi @mosuem, will this update be published on the VS marketplace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to ignore specific errors/warnings
2 participants