Skip to content

Commit

Permalink
Switch off "Microsoft.Maintainability#CA1506" // AvoidExcessiveClassC…
Browse files Browse the repository at this point in the history
…oupling

  -- not readily remediable
  • Loading branch information
SteveGilham committed Dec 19, 2020
1 parent 9c7d96f commit 3607a06
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 45 deletions.
11 changes: 2 additions & 9 deletions AltCover.Engine/Instrument.fs
Expand Up @@ -85,8 +85,6 @@ module internal Instrument =
let version = typeof<AltCover.Recorder.Tracer>.Assembly.GetName().Version.ToString()
let internal resolutionTable = Dictionary<string, AssemblyDefinition>()

[<SuppressMessage("Microsoft.Maintainability", "CA1506",
Justification = "partitioned into closures")>]
module internal I =
let prelude = [ 0x01uy; 0x00uy; 0x02uy; 0x00uy; 0x54uy; 0x0euy;
0x08uy; 0x41uy; 0x73uy; 0x73uy; 0x65uy; 0x6duy;
Expand Down Expand Up @@ -637,7 +635,7 @@ module internal Instrument =

let internal doTrack state (m : MethodEntry) =
m.Track
|> Option.fold (fun (s:InstrumentContext) (n, _) -> // this line for FxCop
|> Option.fold (fun (s:InstrumentContext) (n, _) ->
let body =
[ m.Method.Body; state.MethodBody ].[(m.Inspection.IsInstrumented).ToInt32]
let methodWorker = body.GetILProcessor()
Expand Down Expand Up @@ -826,9 +824,4 @@ module internal Instrument =
// param name="assemblies">List of assembly paths to visit</param>
// returns>Stateful visitor function</returns>
let internal instrumentGenerator(assemblies : string list) =
Visitor.encloseState I.instrumentationVisitor (InstrumentContext.Build assemblies)

[<assembly: SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Scope="member", Target="AltCover.Instrument+I+doTrack@644.#Invoke(AltCover.InstrumentContext,System.Tuple`2<System.Int32,System.String>)",
Justification="Nice idea if you can manage it")>]
()
Visitor.encloseState I.instrumentationVisitor (InstrumentContext.Build assemblies)
4 changes: 0 additions & 4 deletions AltCover.Engine/Main.fs
Expand Up @@ -95,11 +95,7 @@ module internal Main =
"--callContext", x) :: CommandLine.error
(false, Left None)

[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="It's perfectly maintainable.")>]
module internal I =
[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="It's perfectly maintainable.")>]
let internal declareOptions() =
let makeRegex (x : String) =
x.Replace(char 0, '\\').Replace(char 1, '|')
Expand Down
2 changes: 0 additions & 2 deletions AltCover.Engine/OpenCover.fs
Expand Up @@ -77,8 +77,6 @@ module internal OpenCover =
String.Join
(" ", l |> Seq.map (fun i -> i.ToString(CultureInfo.InvariantCulture))))

[<SuppressMessage("Microsoft.Maintainability", "CA1506",
Justification = "partitioned into closures")>]
let internal reportGenerator() =
// The internal state of the document is mutated by the
// operation of the visitor. Everything else should now be pure
Expand Down
5 changes: 0 additions & 5 deletions AltCover.Engine/Runner.fs
Expand Up @@ -149,9 +149,6 @@ module internal Runner =
summaryFormat <- Default
summary.Clear() |> ignore

[<SuppressMessage("Microsoft.Maintainability",
"CA1506:AvoidExcessiveClassCoupling",
Justification="Consolidation point")>]
module internal I =

let internal write line =
Expand Down Expand Up @@ -620,8 +617,6 @@ module internal Runner =
let binpath = report + ".acv"
File.Create(binpath)) ignore

[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="It's OK, really.")>]
module internal J =
let internal requireExe(parse : Either<string * OptionSet, string list * OptionSet>) =
match parse with
Expand Down
4 changes: 0 additions & 4 deletions AltCover.Engine/Visitor.fs
Expand Up @@ -423,8 +423,6 @@ module internal Visitor =
branchNumber <- 0
sourceLinkDocuments <- None

[<SuppressMessage("Microsoft.Maintainability", "CA1506",
Justification = "partitioned into closures")>]
module I =
let private specialCaseFilters =
[ @"^CompareTo\$cont\@\d+\-?\d$"
Expand Down Expand Up @@ -1004,8 +1002,6 @@ module internal Visitor =
|> Seq.sortBy
(fun b -> b.Key) // important! instrumentation assumes we work in the order we started with

[<SuppressMessage("Microsoft.Maintainability", "CA1506",
Justification = "partitioned into closures")>]
let private extractBranchPoints dbg methodFullName rawInstructions interesting vc =
let makeDefault i =
if !CoverageParameters.coalesceBranches then -1 else i
Expand Down
8 changes: 3 additions & 5 deletions AltCover.Fake.DotNet.Testing.AltCover/AltCoverCommand.fs
Expand Up @@ -9,8 +9,6 @@ open Fake.DotNet
[<RequireQualifiedAccess>]
[<SuppressMessage("Gendarme.Rules.Smells", "RelaxedAvoidCodeDuplicatedInSameClassRule",
Justification="Two match statements aren't worth bothering with")>]
[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="This is where it all comes together")>]
module AltCoverCommand =
let private toSeq(s : String seq) =
match s with
Expand Down Expand Up @@ -273,8 +271,8 @@ module AltCoverCommand =
runCore options withMono

[<assembly: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope="member",
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withMono@255T.#monoPath", Justification="Generated code")>]
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withMono@253T.#monoPath", Justification="Generated code")>]
[<assembly: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope="member",
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withMono@255T.#options", Justification="Generated code")>]
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withMono@253T.#options", Justification="Generated code")>]
[<assembly: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope="member",
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withWorkingDirectory@215T.#options", Justification="Generated code")>]()
Target="AltCoverFake.DotNet.Testing.AltCoverCommand+withWorkingDirectory@213T.#options", Justification="Generated code")>]()
2 changes: 0 additions & 2 deletions AltCover.Toolkit/CoverageFormats.fs
Expand Up @@ -30,8 +30,6 @@ module CoverageFormats =
Justification = "AvoidSpeculativeGenerality too")>]
[<SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters",
Justification = "AvoidSpeculativeGenerality too")>]
[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="That's XML + code reuse for you.")>]
let ConvertFromNCover (document:XDocument) (assemblies : string seq) =
let reporter, rewrite = AltCover.OpenCover.reportGenerator()
let visitors = [ reporter ]
Expand Down
2 changes: 0 additions & 2 deletions AltCover.UICommon/CoverageFileTree.fs
Expand Up @@ -209,8 +209,6 @@ module CoverageFileTree =

methods |> Seq.iter (applyToModel model)

[<SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Justification="Where it all comes together")>]
let DoSelected (environment:CoverageModelDisplay<'TModel, 'TRow, 'TIcon>) index =
let current = environment.GetFileInfo index
match CoverageFile.LoadCoverageFile current with
Expand Down
11 changes: 0 additions & 11 deletions AltCover.Visualizer/Visualizer.fs
Expand Up @@ -376,9 +376,6 @@ module private Gui =
let latch = new Threading.ManualResetEvent false
#endif

[<SuppressMessage("Microsoft.Maintainability",
"CA1506:AvoidExcessiveClassCoupling",
Justification = "I see no problem here")>]
let private onRowActivated (handler : Handler) (activation : RowActivatedArgs) =
let hitFilter (activated : RowActivatedArgs) (path : TreePath) =
activated.Path.Compare(path) = 0
Expand Down Expand Up @@ -657,14 +654,6 @@ module private Gui =
Scope="member",
Target="<StartupCode$AltCover-Visualizer>.$Visualizer.#.cctor()",
Justification="Compiler generated")>]
[<assembly: SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Scope="type",
Target="AltCover.Gui",
Justification="That's the way things are")>]
[<assembly: SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling",
Scope="member",
Target="AltCover.Gui.#main(System.String[])",
Justification="That's the way things are")>]
[<assembly: SuppressMessage("Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Scope="member",
Expand Down
3 changes: 2 additions & 1 deletion Build/targets.fsx
Expand Up @@ -716,6 +716,7 @@ _Target "FxCop" (fun _ ->
"-Microsoft.Naming#CA1709" // defer to the Gendarme casing rule for implicit 'a
"-Microsoft.Naming#CA1715" // defer to the Gendarme naming rule for implicit 'a
"-Microsoft.Usage#CA2235" // closures being serializable
"-Microsoft.Maintainability#CA1506" // AvoidExcessiveClassCoupling
]

let standardRules =
Expand Down Expand Up @@ -4651,4 +4652,4 @@ let defaultTarget() =
resetColours()
"All"

Target.runOrDefault <| defaultTarget()
Target.runOrDefault <| defaultTarget()

0 comments on commit 3607a06

Please sign in to comment.