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

[SPN-1438] Guardrail to add deprecated metric for class methods in the codebase #124

Merged
merged 20 commits into from
Jan 27, 2025

Conversation

bknutson123
Copy link
Collaborator

No description provided.

@bknutson123 bknutson123 requested review from jongardiner and a team as code owners January 14, 2025 22:40
bknutson123 and others added 5 commits January 22, 2025 17:07
…pingForServiceMethodDocumentationCheck

[SPN-1447] Start of Service Documentation Guardrail
…tric' into BK/integators/SPN-1440/deprecatedApiAttributeMetric

# Conflicts:
#	src/Checks/ErrorConstants.php
#	src/NodeVisitors/StaticAnalyzer.php
#	tests/units/Checks/TestTemplates.php
…edApiAttributeMetric

[SPN-1440] Web Api Documentation Check and Deprecated API Attribute Metric
bknutson123 and others added 4 commits January 23, 2025 16:27
…edApiAttributeMetric

handle both methods and functions
* fix some of the edge cases for the ServiceMethodDocumentationCheck.php.
* Add better error descriptions
* only run the checks on services and controllers
* handle nullable types in the service check
@@ -69,8 +71,23 @@ public function run($fileName, Node $node, ClassLike $inside = null, Scope $scop
}
}

private function isControllerMethod(ClassLike $inside = null): bool {
Copy link
Member

Choose a reason for hiding this comment

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

can we rename to isControllerClass()? it's not checking the method, just the class.

Copy link
Member

Choose a reason for hiding this comment

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

A note, there is $this->symbolTable->isParentClassOrInterface("fully\qualified\className", $name) available. I don't know if it's entirely appropriate for your use, but thought I'd bring it up in case it can be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch

}
}

private function isServiceMethod(?ClassLike $inside = null) {
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 also isServiceClass(), not method.

@bknutson123 bknutson123 merged commit 067fb57 into master Jan 27, 2025
2 checks passed
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.

3 participants