RocketChat/Rocket.Chat

View on GitHub
apps/meteor/ee/server/settings/saml.ts

Summary

Maintainability
D
1 day
Test Coverage

Function addSettings has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const addSettings = async function (name: string): Promise<void> {
    await settingsRegistry.addGroup('SAML', async function () {
        await this.with(
            {
                tab: 'SAML_Enterprise',
Severity: Major
Found in apps/meteor/ee/server/settings/saml.ts - About 4 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_authn_context_comparison`, 'exact', {
                            type: 'select',
                            values: [
                                { key: 'better', i18nLabel: 'Better' },
                                { key: 'exact', i18nLabel: 'Exact' },
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 1 other location - About 2 hrs to fix
    apps/meteor/app/meteor-accounts-saml/server/lib/settings.ts on lines 199..209

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_Metadata_template`, defaultMetadataTemplate, {
                            type: 'string',
                            invalidValue: defaultMetadataTemplate,
                            i18nLabel: 'SAML_Metadata_Template',
                            i18nDescription: 'SAML_Metadata_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 98..104

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_AuthRequest_template`, defaultAuthRequestTemplate, {
                            type: 'string',
                            invalidValue: defaultAuthRequestTemplate,
                            i18nLabel: 'SAML_AuthnRequest_Template',
                            i18nDescription: 'SAML_AuthnRequest_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 98..104
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_AuthnContext_template`, defaultAuthnContextTemplate, {
                            type: 'string',
                            invalidValue: defaultAuthnContextTemplate,
                            i18nLabel: 'SAML_AuthnContext_Template',
                            i18nDescription: 'SAML_AuthnContext_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 98..104
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_LogoutRequest_template`, defaultLogoutRequestTemplate, {
                            type: 'string',
                            invalidValue: defaultLogoutRequestTemplate,
                            i18nLabel: 'SAML_LogoutRequest_Template',
                            i18nDescription: 'SAML_LogoutRequest_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 98..104
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_LogoutResponse_template`, defaultLogoutResponseTemplate, {
                            type: 'string',
                            invalidValue: defaultLogoutResponseTemplate,
                            i18nLabel: 'SAML_LogoutResponse_Template',
                            i18nDescription: 'SAML_LogoutResponse_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 98..104
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_NameId_template`, defaultNameIDTemplate, {
                            type: 'string',
                            invalidValue: defaultNameIDTemplate,
                            i18nLabel: 'SAML_NameIdPolicy_Template',
                            i18nDescription: 'SAML_NameIdPolicy_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 98..104
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_MetadataCertificate_template`, defaultMetadataCertificateTemplate, {
                            type: 'string',
                            invalidValue: defaultMetadataCertificateTemplate,
                            i18nLabel: 'SAML_MetadataCertificate_Template',
                            i18nDescription: 'SAML_Metadata_Certificate_Template_Description',
    Severity: Major
    Found in apps/meteor/ee/server/settings/saml.ts and 6 other locations - About 45 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 46..52
    apps/meteor/ee/server/settings/saml.ts on lines 70..76
    apps/meteor/ee/server/settings/saml.ts on lines 77..83
    apps/meteor/ee/server/settings/saml.ts on lines 84..90
    apps/meteor/ee/server/settings/saml.ts on lines 91..97
    apps/meteor/ee/server/settings/saml.ts on lines 105..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_custom_authn_context`, defaultAuthnContext, {
                            type: 'string',
                            invalidValue: defaultAuthnContext,
                            i18nLabel: 'SAML_Custom_Authn_Context',
                            i18nDescription: 'SAML_Custom_Authn_Context_description',
    Severity: Minor
    Found in apps/meteor/ee/server/settings/saml.ts and 1 other location - About 30 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 40..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                        await this.add(`SAML_Custom_${name}_identifier_format`, defaultIdentifierFormat, {
                            type: 'string',
                            invalidValue: defaultIdentifierFormat,
                            i18nLabel: 'SAML_Identifier_Format',
                            i18nDescription: 'SAML_Identifier_Format_Description',
    Severity: Minor
    Found in apps/meteor/ee/server/settings/saml.ts and 1 other location - About 30 mins to fix
    apps/meteor/ee/server/settings/saml.ts on lines 53..58

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status