Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Fallback to syntax-check if ansible-lint is not installed or disabled #5

Merged
merged 44 commits into from
Oct 8, 2021

Conversation

priyamsahoo
Copy link
Contributor

@priyamsahoo priyamsahoo commented Aug 23, 2021

Add logic to fallback to ansible syntax-check for diagnostics in-case ansible-lint is not installed (or disabled) in the user's environment.

Fixes: ansible/vscode-ansible#146

@priyamsahoo
Copy link
Contributor Author

@ganeshrn, I haven't created a separate ansiblePlaybook class. The reason is because, I didn't find any method to go into that class which can further be inherited by ansibleSyntaxCheck class. I find all the methods to be unique to ansibleSyntaxCheck class itself.

Need your review and thoughts before implementing the ansiblePlaybook class.

@ganeshrn
Copy link
Member

/cc @tomaciazek

Copy link
Contributor

@tomaciazek tomaciazek left a comment

Choose a reason for hiding this comment

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

Good work, but there are some issues and copy-paste left-overs.

The libraryChecker name sounds misleading to me, given what it does and what it works with, but maybe that's just me.

src/interfaces/extensionSettings.ts Outdated Show resolved Hide resolved
src/providers/validationProvider.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
src/utils/libraryChecker.ts Outdated Show resolved Hide resolved
src/utils/libraryChecker.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
src/services/ansibleSyntaxCheck.ts Outdated Show resolved Hide resolved
@priyamsahoo priyamsahoo force-pushed the syntax-check branch 2 times, most recently from d02ffe6 to f8a9c68 Compare September 15, 2021 12:30
Copy link
Contributor

@tomaciazek tomaciazek left a comment

Choose a reason for hiding this comment

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

Is use of console.debug on purpose? If not, all instances should be converted to use of connection.console.

src/services/ansibleLint.ts Outdated Show resolved Hide resolved
src/services/ansiblePlaybook.ts Outdated Show resolved Hide resolved
src/services/ansiblePlaybook.ts Show resolved Hide resolved
src/services/workspaceManager.ts Outdated Show resolved Hide resolved
@webknjaz
Copy link
Member

Is use of console.debug on purpose? If not, all instances should be converted to use of connection.console.

I think debug is for devs (shows up in the JS console) and console as for end-users.

@tomaciazek
Copy link
Contributor

Is use of console.debug on purpose? If not, all instances should be converted to use of connection.console.

I think debug is for devs (shows up in the JS console) and console as for end-users.

Alright, if that is a conscious use, then I'm okay with that. If this is something that should be visible in the Ansible Server logs (available for the end-user), then it should be changed.

@priyamsahoo
Copy link
Contributor Author

Is use of console.debug on purpose? If not, all instances should be converted to use of connection.console.

That's for the devs. These messages appear in the log and can be useful for debugging purposes. I did not intend those messages for the users. That's why I do not want to use connection.console

@priyamsahoo priyamsahoo requested a review from a team as a code owner October 5, 2021 10:42
@ssbarnea
Copy link
Member

ssbarnea commented Oct 6, 2021

the linter can easily disappear (python version upgrade) and we need to inform the user that he is running in without it.

Think about divergent behaviour and bug reports from users not having the linter and expecting it to run. There will be LOTs.

I am not saying that we should necessarily display a popup error message but at least we need to make it easy to discover the source of the problem. Two thinks come into my mind:

  • can we add a collapsed notification? i remember the bell from status bug were vscode updates appear, is not intrusive but it is a place were people would look when something does not work as excepted.
  • tooltip/hover on Ansible language status bar to display environment info like version of ansible and ansible lint.

Ideally we should have prompted the user to install the linter automatically like vscode does for flake8 for example. Sadly that functionality is hard to implement. Microsoft did not make easy to reuse the install missing python dependency.

@webknjaz
Copy link
Member

webknjaz commented Oct 6, 2021

@ssbarnea your suggestion sounds reasonable, however, I'd move the implementation/discussion out of this PR. I'm sure Priyam can't wait to get this merged after so many rounds of review.

This change is done to support notification generation from the validation
provider so that we can generate a notification for falling back to
syntax-check from validation provider and not from the ansible lint service.
@priyamsahoo
Copy link
Contributor Author

@ssbarnea, @webknjaz, thanks for the suggestions. But as @webknjaz said, we can move this discussion out of the PR :)

@ssbarnea ssbarnea added the enhancement New feature or request label Oct 7, 2021
@ssbarnea ssbarnea merged commit 3298703 into ansible:main Oct 8, 2021
export class AnsiblePlaybook {
private useProgressTracker = false;

/**
Copy link
Member

Choose a reason for hiding this comment

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

I think this is missing some text description.

@priyamsahoo priyamsahoo deleted the syntax-check branch September 13, 2022 13:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
5 participants