Beispiel #1
0
        /// <inheritdoc/>
        public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
        {
            switch (profileType)
            {
            case CodeCleanup.DefaultProfileType.FULL:
                profile.SetSetting(DescriptorInstance, true);
                break;

            default:
                profile.SetSetting(DescriptorInstance, false);
                break;
            }
        }
    public void SetDefaultSetting(CodeCleanupProfile profile, Feature.Services.CodeCleanup.CodeCleanup.DefaultProfileType profileType)
    {
      switch (profileType)
      {
        case Feature.Services.CodeCleanup.CodeCleanup.DefaultProfileType.FULL:
          profile.SetSetting(DescriptorInstance, true);
          break;

        case Feature.Services.CodeCleanup.CodeCleanup.DefaultProfileType.REFORMAT:
          profile.SetSetting(DescriptorInstance, false);
          break;
        default:
          throw new ArgumentOutOfRangeException("profileType");
      }
    }
Beispiel #3
0
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            OrderingOptions options        = new OrderingOptions();
            XmlElement      optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.AlphabeticalUsingDirectives =
                        (AlphabeticalUsingsStyle)
                        Enum.Parse(typeof(AlphabeticalUsingsStyle), JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "AlphabeticalUsingDirectives"));
                    options.ExpandUsingDirectives =
                        (ExpandUsingsStyle)Enum.Parse(typeof(ExpandUsingsStyle), JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "ExpandUsingDirectives"));
                    options.SA1212PropertyAccessorsMustFollowOrder =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1212PropertyAccessorsMustFollowOrder"));
                    options.SA1213EventAccessorsMustFollowOrder =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1213EventAccessorsMustFollowOrder"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
Beispiel #4
0
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            SpacingOptions options        = new SpacingOptions();
            XmlElement     optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.SA1001CommasMustBeSpacedCorrectly =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1001CommasMustBeSpacedCorrectly"));
                    options.SA1005SingleLineCommentsMustBeginWithSingleSpace =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1005SingleLineCommentsMustBeginWithSingleSpace"));
                    options.SA1006PreprocessorKeywordsMustNotBePrecededBySpace =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1006PreprocessorKeywordsMustNotBePrecededBySpace"));
                    options.SA1021NegativeSignsMustBeSpacedCorrectly =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1021NegativeSignsMustBeSpacedCorrectly"));
                    options.SA1022PositiveSignsMustBeSpacedCorrectly =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1022PositiveSignsMustBeSpacedCorrectly"));
                    options.SA1025CodeMustNotContainMultipleWhitespaceInARow =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1025CodeMustNotContainMultipleWhitespaceInARow"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
        public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
        {
            switch (profileType)
            {
            case CodeCleanup.DefaultProfileType.FULL:
                profile.SetSetting(DescriptorInstance, false);
                break;

            case CodeCleanup.DefaultProfileType.REFORMAT:
                profile.SetSetting(DescriptorInstance, true);
                break;

            default:
                throw new ArgumentOutOfRangeException("profileType");
            }
        }
Beispiel #6
0
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            LayoutOptions options        = new LayoutOptions();
            XmlElement    optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine"));
                    options.SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine"));
                    options.SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine"));
                    options.SA1511WhileDoFooterMustNotBePrecededByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1511WhileDoFooterMustNotBePrecededByBlankLine"));
                    options.SA1512SingleLineCommentsMustNotBeFollowedByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1512SingleLineCommentsMustNotBeFollowedByBlankLine"));
                    options.SA1513ClosingCurlyBracketMustBeFollowedByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1513ClosingCurlyBracketMustBeFollowedByBlankLine"));
                    options.SA1514ElementDocumentationHeaderMustBePrecededByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1514ElementDocumentationHeaderMustBePrecededByBlankLine"));
                    options.SA1515SingleLineCommentMustBeProceededByBlankLine =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1515SingleLineCommentMustBeProceededByBlankLine"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            ReadabilityOptions options        = new ReadabilityOptions();
            XmlElement         optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists"));
                    options.SA1106CodeMustNotContainEmptyStatements =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1106CodeMustNotContainEmptyStatements"));
                    options.SA1108BlockStatementsMustNotContainEmbeddedComments =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1108BlockStatementsMustNotContainEmbeddedComments"));
                    options.SA1109BlockStatementsMustNotContainEmbeddedRegions =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1109BlockStatementsMustNotContainEmbeddedRegions"));
                    options.SA1120CommentsMustContainText       = bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1120CommentsMustContainText"));
                    options.SA1121UseBuiltInTypeAlias           = bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1121UseBuiltInTypeAlias"));
                    options.SA1122UseStringEmptyForEmptyStrings =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1122UseStringEmptyForEmptyStrings"));
                    options.SA1123DoNotPlaceRegionsWithinElements =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1123DoNotPlaceRegionsWithinElements"));
                    options.SA1124CodeMustNotContainEmptyRegions =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1124CodeMustNotContainEmptyRegions"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
 public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
 {
   switch (profileType)
   {
     case CodeCleanup.DefaultProfileType.FULL:
     case CodeCleanup.DefaultProfileType.REFORMAT:
       profile.SetSetting(OurDescriptor, true);
       break;
     default:
       throw new ArgumentOutOfRangeException("profileType");
   }
 }
        /// <summary>
        /// Get default setting for given profile type.
        /// </summary>
        /// <param name="profile">
        /// The code cleanup profile to use.
        /// </param>
        /// <param name="profileType">
        /// Determine if it is a full or reformat <see cref="CodeCleanup.DefaultProfileType"/>.
        /// </param>
        public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
        {
            // Default option are set in the constructors.
            OrderingOptions orderingOptions = new OrderingOptions();

            profile.SetSetting(OrderingDescriptor, orderingOptions);

            LayoutOptions layoutOptions = new LayoutOptions();

            profile.SetSetting(LayoutDescriptor, layoutOptions);

            DocumentationOptions documentationOptions = new DocumentationOptions();

            profile.SetSetting(DocumentationDescriptor, documentationOptions);

            SpacingOptions spacingOptions = new SpacingOptions();

            profile.SetSetting(SpacingDescriptor, spacingOptions);

            ReadabilityOptions readabilityOptions = new ReadabilityOptions();

            profile.SetSetting(ReadabilityDescriptor, readabilityOptions);

            MaintainabilityOptions maintainabilityOptions = new MaintainabilityOptions();

            profile.SetSetting(MaintainabilityDescriptor, maintainabilityOptions);
        }
Beispiel #10
0
        public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
        {
            switch (profileType)
            {
            case CodeCleanup.DefaultProfileType.FULL:
            case CodeCleanup.DefaultProfileType.REFORMAT:
            case CodeCleanup.DefaultProfileType.CODE_STYLE:
                profile.SetSetting(ourDescriptor, true);
                break;

            default:
                throw new ArgumentOutOfRangeException("profileType");
            }
        }
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            DocumentationOptions options        = new DocumentationOptions();
            XmlElement           optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.SA1600ElementsMustBeDocumented            = bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1600ElementsMustBeDocumented"));
                    options.SA1604ElementDocumentationMustHaveSummary =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1604ElementDocumentationMustHaveSummary"));
                    options.SA1609PropertyDocumentationMustHaveValue =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1609PropertyDocumentationMustHaveValueDocumented"));
                    options.SA1611ElementParametersMustBeDocumented =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1611ElementParametersMustBeDocumented"));
                    options.SA1615ElementReturnValueMustBeDocumented =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1615ElementReturnValueMustBeDocumented"));
                    options.SA1617VoidReturnValueMustNotBeDocumented =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1617VoidReturnValueMustNotBeDocumented"));
                    options.SA1618GenericTypeParametersMustBeDocumented =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1618GenericTypeParametersMustBeDocumented"));
                    options.SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes"));
                    options.SA1628DocumentationTextMustBeginWithACapitalLetter =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1628DocumentationTextMustBeginWithACapitalLetter"));
                    options.SA1629DocumentationTextMustEndWithAPeriod =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1629DocumentationTextMustEndWithAPeriod"));
                    options.SA1633SA1641UpdateFileHeader =
                        (UpdateFileHeaderStyle)
                        Enum.Parse(typeof(UpdateFileHeaderStyle), JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1633SA1641UpdateFileHeader"));
                    options.SA1639FileHeaderMustHaveSummary =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1639FileHeaderMustHaveSummary"));
                    options.SA1642ConstructorSummaryDocumentationMustBeginWithStandardText =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1642ConstructorSummaryDocumentationMustBeginWithStandardText"));
                    options.SA1643DestructorSummaryDocumentationMustBeginWithStandardText =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1643DestructorSummaryDocumentationMustBeginWithStandardText"));
                    options.SA1644DocumentationHeadersMustNotContainBlankLines =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1644DocumentationHeadersMustNotContainBlankLines"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
        /// <summary>
        /// Loads the specified profile.
        /// </summary>
        /// <param name="profile">
        /// The profile.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        public override void Load(CodeCleanupProfile profile, XmlElement element)
        {
            MaintainabilityOptions options        = new MaintainabilityOptions();
            XmlElement             optionsElement = (XmlElement)element.SelectSingleNode(this.Name);

            if (optionsElement != null)
            {
                try
                {
                    options.SA1119StatementMustNotUseUnnecessaryParenthesis =
                        bool.Parse(JB::JetBrains.Util.XmlUtil.ReadLeafElementValue(optionsElement, "SA1119StatementMustNotUseUnnecessaryParenthesis"));
                }
                catch (ArgumentException)
                {
                }
            }

            profile.SetSetting(this, options);
        }
        /// <summary>
        /// Get default setting for given profile type.
        /// </summary>
        /// <param name="profile">
        /// The code cleanup profile to use.
        /// </param>
        /// <param name="profileType">
        /// Determine if it is a full or reformat <see cref="CodeCleanup.DefaultProfileType"/>.
        /// </param>
        public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
        {
            // Default option are set in the constructors.
            OrderingOptions orderingOptions = new OrderingOptions();
            profile.SetSetting(OrderingDescriptor, orderingOptions);

            LayoutOptions layoutOptions = new LayoutOptions();
            profile.SetSetting(LayoutDescriptor, layoutOptions);

            DocumentationOptions documentationOptions = new DocumentationOptions();
            profile.SetSetting(DocumentationDescriptor, documentationOptions);

            SpacingOptions spacingOptions = new SpacingOptions();
            profile.SetSetting(SpacingDescriptor, spacingOptions);

            ReadabilityOptions readabilityOptions = new ReadabilityOptions();
            profile.SetSetting(ReadabilityDescriptor, readabilityOptions);

            MaintainabilityOptions maintainabilityOptions = new MaintainabilityOptions();
            profile.SetSetting(MaintainabilityDescriptor, maintainabilityOptions);
        }
 /// <inheritdoc/>
 public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
 {
     switch (profileType)
     {
         case CodeCleanup.DefaultProfileType.FULL:
             profile.SetSetting(DescriptorInstance, true);
             break;
         default:
             profile.SetSetting(DescriptorInstance, false);
             break;
     }
 }
 /// <summary>
 /// Get default setting for given profile type.
 /// </summary>
 /// <param name="profile">
 /// The code cleanup profile to use.
 /// </param>
 /// <param name="profileType">
 /// Determine if it is a full or reformat <see cref="CodeCleanup.DefaultProfileType"/>.
 /// </param>
 public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
 {
     profile.SetSetting(FIX_VIOLATIONS, value: true);
     profile.SetSetting(CREATE_XML_DOC_STUB, value: false);
 }
 /// <summary>
 /// Get default setting for given profile type.
 /// </summary>
 /// <param name="profile">
 /// The code cleanup profile to use.
 /// </param>
 /// <param name="profileType">
 /// Determine if it is a full or reformat <see cref="CodeCleanup.DefaultProfileType"/>.
 /// </param>
 public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
 {
     profile.SetSetting(Descriptor, new StyleCopCodeCleanupOptions());
 }
 /// <summary>
 /// Get default setting for given profile type.
 /// </summary>
 /// <param name="profile">
 /// The code cleanup profile to use.
 /// </param>
 /// <param name="profileType">
 /// Determine if it is a full or reformat <see cref="CodeCleanup.DefaultProfileType"/>.
 /// </param>
 public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
 {
     profile.SetSetting(Descriptor, true);
 }