Skip to content

Commit

Permalink
Fix invalid 'implicit scope' report on global or autoload function
Browse files Browse the repository at this point in the history
```vim
function SomeFunc()
endfunction

function aaa#bbb()
endfunction
```
  • Loading branch information
rhysd committed Nov 28, 2015
1 parent 18217d7 commit 2676a92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions vint/ast/plugin/scope_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from vint.ast.plugin.scope_plugin.identifier_classifier import (
is_autoload_identifier as _is_autoload_identifier,
is_function_identifier as _is_function_identifier,
)


Expand Down Expand Up @@ -52,6 +53,9 @@ def is_autoload_identifier(self, node):
return _is_autoload_identifier(node)


def is_function_identifier(self, node):
return _is_function_identifier(node)

def get_objective_scope_visibility(self, node):
link_registry = self._get_link_registry()
context_scope = link_registry.get_context_scope_by_identifier(node)
Expand Down
3 changes: 2 additions & 1 deletion vint/linting/policy/prohibit_implicit_scope_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def is_valid(self, identifier, lint_context):
policy_options = self.get_policy_options(lint_context)
suppress_autoload = policy_options['suppress_autoload']

is_valid = (explicity is not ExplicityOfScopeVisibility.IMPLICIT or
is_valid = scope_plugin.is_function_identifier(identifier) or (
explicity is not ExplicityOfScopeVisibility.IMPLICIT or
is_autoload and suppress_autoload)

if not is_valid:
Expand Down

0 comments on commit 2676a92

Please sign in to comment.