Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Code inspection improvements #5935

Merged
merged 17 commits into from
Jan 9, 2014
Merged

Conversation

ingorichter
Copy link
Contributor

Adding support (functional and partly visual) for having multiple code linters for the same document type.
This means you can have both JSLint and JSHint (it's questionable if this makes sense) linter produce linting results.

Once a linter was registered for a file type, it will run with every save operation (unless this is disabled in the UI). There is no exposed UI way to enable/disable a linter, this means at the moment "All or nothing". You can uninstall the extension that provides the linter functionality to get rid of it's warnings. It's still TBD how a UI for this could look like.

Here is how ti looks like for a JSHint and JSLint fighting for your attention:
screenshot 2013-11-11 09 42 27

@@ -186,6 +186,7 @@ define({
"STATUSBAR_LINE_COUNT_PLURAL" : "\u2014 {0} Lines",

// CodeInspection: errors/warnings
"CODE_INSPECTION_PANEL_TITLE" : "Code Inspection",
Copy link
Member

Choose a reason for hiding this comment

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

I won't be able to do a full code review until tomorrow, but because string freeze is today we need to at least finalize the strings tonight (we can merge them into master alone in a separate PR so they land in time).

I'd be hesitant to change the panel title to "Code Inspection" when everything else in the UI uses the term "lint" still. Here are some alternatives:

  • Generic string like "Problems" or "Lint Results"
  • String with total count (similar to Find in Files panel header), like "14 Problems" or "14 Lint Problems"
  • Show name of provider (same as today) if only one registered; fall back to one of the above string options if > 1 provider

I'm leaning toward the last option, with the fallback being a numeric one like "14 Lint Problems" or "14 Lint Issues." @ingorichter @njx thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I wound up going with the last suggestion and merging that in before string freeze. So this PR needs to be updated to use the new strings.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this doesn't reflect the strings that were merged in last sprint -- see discussion above and #5953.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I've missed this part...

peterflynn added a commit that referenced this pull request Nov 12, 2013
…int 34

ends (but after string freeze has begun)
peterflynn added a commit that referenced this pull request Nov 12, 2013
@ghost ghost assigned peterflynn Nov 12, 2013
@@ -38,7 +38,7 @@
*/
define(function (require, exports, module) {
"use strict";

Copy link
Member

Choose a reason for hiding this comment

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

Nit: there are a lot of whitespace diffs in this file -- probably from some sort of 'whitespace cleaner' extension. It's best to disable such extensions when editing the Brackets source code (or any code that's typically edited in Brackets), since Brackets will always generate indented whitespace like this... creating a never-ending stream of diffs every time you commit. Almost half the diffs here are just whitespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh, I forgot about the whitespace removal. My apologies. I like to have everything clean and tidy. Old habits. Perhaps you could apply ?w=1 to the url and don't get bothered by too many whitespace changes.

@@ -187,82 +201,151 @@ define(function (require, exports, module) {
return response.promise();
}

function updatePanelTitleAndStatusBar(numProblems, providerReportingProblems, providerList, aborted) {
// don't show a header if there is only one provider available for this file type
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this comment belongs with the line that calls hide()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Moved to it's original location.

@peterflynn
Copy link
Member

@ingorichter Done rereviewing -- getting close!

Also looks like there's a merge conflict somewhere that needs to get resolved...


PerfUtils.addMeasurement(perfTimerInspector);
response.resolve(result);
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit subtle, but: putting addMeasurement() after response.resolve() -- instead of before like it is on master -- means the measured time will include everything in the caller's done() handler as well, which in this case includes all the table-generating code in run(). Could you switch the order back so this matches master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the order to match the one on master

@peterflynn
Copy link
Member

@ingorichter You think you still have time to do those last fixes? Otherwise we may want to punt this to Sprint 36...

@ingorichter
Copy link
Contributor Author

@peterflynn If you are not too tired of reviewing this... I hope, that I didn't miss anything this time

html = Mustache.render(ResultsTemplate, {reportList: allErrors});
});

// Update results table
Copy link
Contributor

Choose a reason for hiding this comment

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

This entire block, lines 332-350 up to else, should go into .then handler where html is prepared. Otherwise it will be operating empty html since the template is rendered in .then handler (see line 329 above). It will show up once there's a real delay in provider execution.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, and that's how it is on master before this PR...

// This is a special case to enable extension provider to replace the JSLint provider
// in favor of their own implementation
_.remove(_providers[languageId], function (registeredProvider) {
return registeredProvider.name === "JSLint";
Copy link
Member

Choose a reason for hiding this comment

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

This is a little delicate since it relies on the localized name field. But I've checked and all locales use the string "JSLint," and this code will go away once there's UI for enabling/disabling providers -- so I think this is ok for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't find something better here. But moving forward, this code should be removed sooner or later.

…ction-improvements

* origin/master: (187 commits)
  improve comments
  update comments
  Fix a comment typo and just log the unhandled exception instead of trying to reject the promise, which probably won't work anyway.
  Enable Quick Docs for LESS
  Return a promise from ProjectManager.getAllFiles that is resiliant to misbehaving done handlers
  Updated by ALF automation.
  Revert LiveDev timeout changes
  Use Brackets shell for copying files to reduce the number of external watcher notifications and increase timeouts
  Don't refresh the file tree on change events for directories outside of the project root, but when we do refresh the file tree, also clear the change queue (using a new PromiseQueue.removeAll method) and use a debounced refreshFileTree call
  fix check for added and removed files in fs change event handler
  always hide dirty dot if there is no doc
  Fix selection update after fs change event. Remove unnecessary updates when no added or removed files are present.
  backout change for dismissing list
  Right aligning numbers column.
  Removed most inline css.
  Adding LOCALE_KO
  Initial commit.
  Fixed some dutch spelling/translation errors.
  Bump up timeouts to account for additional Project Manager synchronization
  Made canvas height 300 to stop weird rounding.
  ...

Conflicts:
	src/language/CodeInspection.js
@peterflynn
Copy link
Member

@ingorichter I took the liberty of pushing up a commit that fixes the last few remaining comments I had (including the issue @busykai was hitting in #6375), along with a few more documentation updates.

So from my standpoint, I think it's good to land now. Do you want to take a look at my commit before merging?

@peterflynn
Copy link
Member

I've also filed bugs on the two extensions that will be broken by the inspectFile() API change, and documented the change in the release notes.

@ingorichter
Copy link
Contributor Author

@peterflynn Thank you for the last fixes. Tests passed. I think, we can go ahead and merge it. 👍

@peterflynn
Copy link
Member

Oops, I realized the docs for inspectFile() said something incorrect (and had some mis-formatted type annotations) -- just pushed up a fix for that too. I think those docs-only fixes are noncontroversial enough that I can just go ahead & merge without further review.

peterflynn added a commit that referenced this pull request Jan 9, 2014
…ents

Code inspection improvements - allow multiple linters / code inspectors to be registered for each Language, with consolidated results
@peterflynn peterflynn merged commit ad5f5d7 into master Jan 9, 2014
@peterflynn peterflynn deleted the irichter/code-inspection-improvements branch January 9, 2014 19:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants