Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-288056: "Parameter is only used for precondition check(s)" should not activate when the whole method IS the precondition test.

$
0
0
Reporter Johan Tidén (jtiden) Johan Tidén (jtiden)
Created Jan 28, 2012 6:28:25 PM
Updated Jan 28, 2012 6:29:09 PM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Code Analysis - Usage Checking
Affected versions No Affected versions
Fixed in build No Fixed in build
"Parameter <x> is only used for precondition check(s)" activates when a parameter is only used for and makes resharper behave like UnusedParameter.Local.

However, when the whole body of the function is supposed to be the precondition check(s), this advice is useless since the user intentionally designed it like this. (see code example)


        public IMatrixDense Multiply(IMatrixDense other)
        {
            CheckMatrixDimensionAgree(other);
            return new MatrixMultiplier(this, other).MultiplyToDense();
        }

        private void CheckMatrixDimensionAgree(Matrix other) // warning "Parameter other is only used for precondition check(s)"
        {
            if(Columns != other.Rows)
                throw new ArgumentException("Inner matrix dimensions must agree.");
        }

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>