
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
By convention, namespaces within a project should start with the project default namespace, and end with the file's position within the project. Anything else may confuse maintainers and callers.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,csharp]
|
|
----
|
|
// file path: Gui/Screen.cs
|
|
namespace Green // Noncompliant
|
|
{
|
|
class Screen
|
|
{
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,csharp]
|
|
----
|
|
// file path: Gui/Screen.cs
|
|
namespace Gui
|
|
{
|
|
class Screen
|
|
{
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== is related to: S3317
|
|
|
|
=== on 9 Jul 2015, 14:13:11 Ann Campbell wrote:
|
|
\[~tamas.vajk], I know you said we probably didn't need a code example, but I really felt like we needed to illustrate what we were looking for.
|
|
|
|
|
|
My code sample is probably wrong. Would you clean it up, please?
|
|
|
|
=== on 20 Jul 2015, 11:27:37 Tamas Vajk wrote:
|
|
\[~ann.campbell.2] I fixed the samples.
|
|
|
|
|
|
We could also have a similar rule for class and file name mappings. Or we could just add it to this rule. Class names should match their containing file name.
|
|
|
|
=== on 20 Jul 2015, 14:30:45 Ann Campbell wrote:
|
|
\[~tamas.vajk] what about the fact that I can have multiple top-level classes in a file?
|
|
|
|
=== on 4 Aug 2015, 14:51:51 Tamas Vajk wrote:
|
|
\[~ann.campbell.2] You can, but you shouldn't. We could check if any of the top-level classes' names match the file name. Also, there is a problem with ``++partial++`` classes. They might be defined in multiple files in the same folder. So we can't force the file name to be identical. In this case usually we have a file name in the following format: _CLASSNAME.SOMEOTHERNAME.cs_, for example: _MyForm.Designer.cs_
|
|
|
|
=== on 5 Aug 2015, 15:32:43 Ann Campbell wrote:
|
|
Thanks [~tamas.vajk]. I created a new rule (which is assigned to you).
|
|
|
|
|
|
Note that I've also pulled this phrase from the Noncompliant example section: Given a project default namespace of "MyProject"
|
|
|
|
Since there was no reference to "MyProject" in the code itself.
|
|
|
|
endif::env-github,rspecator-view[]
|