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

SA1516 should require a line before attributes #737

Closed
Przemyslaw-W opened this issue Apr 27, 2015 · 3 comments
Closed

SA1516 should require a line before attributes #737

Przemyslaw-W opened this issue Apr 27, 2015 · 3 comments
Assignees
Milestone

Comments

@Przemyslaw-W
Copy link

If attribute is added to type or member, there should be blank line enforced above it, unless

  • there is another attribute or xml doc comment in the line above
  • element decorated with attribute is first element of its parent (e.g. first member in the type, or first type in a namespace)
  • attribute is added inline - e.g. attributes added for parameters should not trigger this rule

Rationale - currently SC enforces blank line before element if there are no attributes and xml doc comments at all. It also enforces blank line above xml doc comment. Attributes feel like missing piece in the whole puzzle

@vweijsters
Copy link
Contributor

👍 Good suggestion, I think we should treat attributes the same as the other stuff indeed.

@sharwell
Copy link
Member

This is a bug in SA1516, although it's still caught in most cases by SA1513.

@sharwell sharwell added the bug label Apr 27, 2015
@Przemyslaw-W
Copy link
Author

IMHO it would be strange to fix it within SA1516 scope, since xml doc comments do have separate dedicated rule - SA1514

@sharwell sharwell changed the title Rule proposal: Layout rule - Blank line required before attributes SA1516 should require a line before attributes Sep 12, 2015
@sharwell sharwell added this to the 1.0.0 Beta 12 milestone Sep 12, 2015
@sharwell sharwell self-assigned this Sep 12, 2015
sharwell added a commit to sharwell/StyleCopAnalyzers that referenced this issue Sep 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants