auth0-extensions/auth0-delegated-administration-extension

View on GitHub

Showing 66 of 178 total issues

Function RequireAuthentication has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function RequireAuthentication(InnerComponent) {
  class RequireAuthenticationContainer extends React.Component {
    static propTypes = {
      push: PropTypes.func.isRequired,
      auth: PropTypes.object.isRequired,
Severity: Minor
Found in client/containers/RequireAuthentication.jsx - About 1 hr to fix

    Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { logId, error, loading, onClose, settings } = this.props;
        if (logId === null) {
          return <div></div>;
        }
    Severity: Minor
    Found in client/components/Logs/LogDialog.jsx - About 1 hr to fix

      Function loadCredentials has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function loadCredentials() {
        return (dispatch) => {
          if (window.location.hash) {
            dispatch({
              type: constants.LOGIN_PENDING
      Severity: Minor
      Found in client/actions/auth.js - About 1 hr to fix

        Function getLanguageDictionary has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getLanguageDictionary(response, onSuccess) {
          const settings = _.get(response, 'data.settings', {});
          let promise = Promise.resolve({ data: {} });
          if (settings.languageDictionary) {
            if (_.isObject(settings.languageDictionary)) {
        Severity: Minor
        Found in client/actions/auth.js - About 1 hr to fix

          Function parseFieldSection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const parseFieldSection = (property, sectionInfo, sectionName, inheritedDisplay) => {
            if (sectionInfo && _.isObject(sectionInfo)) {
              const sectionDisplay = parseFunction(property, `${sectionName}.display`, sectionInfo.display);
              const display = sectionDisplay !== undefined ? sectionDisplay : inheritedDisplay;
              if (display !== undefined) sectionInfo.display = display;
          Severity: Minor
          Found in client/reducers/settings.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const {
                loading,
                error,
                users,
          Severity: Minor
          Found in client/containers/Users/Users.jsx - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function addExtraUserInfo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const addExtraUserInfo = (token, user) => {
              global.daeUser = global.daeUser || {};
              global.daeUser[user.sub] = global.daeUser[user.sub] || { exp: 0, token: '' };
          
              if (_.isFunction(global.daeUser[user.sub].then)) {
          Severity: Minor
          Found in server/routes/api.js - About 1 hr to fix

            Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { auth, languageDictionary } = this.props;
            
                if (auth.error) {
                  return (
            Severity: Minor
            Found in client/containers/Login.jsx - About 1 hr to fix

              Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const fields = this.props.customFields || [];
              
                  if (fields.length === 0) return null;
              
              
              Severity: Minor
              Found in client/components/Users/UserFieldsChangeForm.jsx - About 1 hr to fix

                Function fetchUsers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
                  return (dispatch, getState) => {
                    const { sortProperty, sortOrder, searchValue, selectedFilter } = getState().users.toJS();
                    const meta = { page, sortProperty, sortOrder, searchValue, onSuccess };
                    meta.selectedFilter = reset ? '' : filterBy || selectedFilter;
                Severity: Minor
                Found in client/actions/user.js - About 1 hr to fix

                  Function fetchUsers has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
                  Severity: Minor
                  Found in client/actions/user.js - About 45 mins to fix

                    Function getName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      getName(iss, user) {
                        let thisMenuName = this.props.getDictValue('menuName');
                    
                        thisMenuName = thisMenuName || (user && user.get('name'));
                        thisMenuName = thisMenuName || (user && user.get('nickname'));
                    Severity: Minor
                    Found in client/components/Header.jsx - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function checkCustomFieldValidation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const checkCustomFieldValidation = (req, context, isEditRequest, onlyTheseFields) => {
                      /* Exit early if no custom fields */
                      if (!context.userFields) return context.payload;
                    
                      const requiredErrorText = (req.query && req.query.requiredErrorText) || 'required';
                    Severity: Minor
                    Found in server/routes/users.js - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render() {
                        const { field, isEditField } = this.props;
                        const formType = isEditField ? 'edit' : 'create';
                    
                        /* End early if property is not defined or edit/create is not defined */
                    Severity: Minor
                    Found in client/components/Users/UserFormField.jsx - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Consider simplifying this complex logical expression.
                    Open

                                      if (field.property === 'picture') {
                                        return (
                                          <TableCell>
                                            <img
                                              className="img-circle"
                    Severity: Major
                    Found in client/components/Users/UsersTable.jsx - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                if (response.statusCode < 200 || response.statusCode >= 300) {
                                  logger.error('Log response failed: ', response.headers);
                                  return next(new Error((body && (body.error || body.message || body.code)) || `Request Error: ${response.statusCode}`));
                                }
                      Severity: Major
                      Found in server/routes/users.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (err && (err.status || err.statusCode)) {
                              res.status(err.status || err.statusCode);
                              return res.json({
                                error: err.code || err.name,
                                message: err.message || err.name
                        Severity: Major
                        Found in server/lib/middlewares/errorHandler.js - About 40 mins to fix

                          Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render() {
                              const fields = this.props.customFields || [];
                          
                              if (fields.length === 0) return null;
                          
                          
                          Severity: Minor
                          Found in client/components/Users/UserFieldsChangeForm.jsx - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function requestUserBlocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const requestUserBlocks = (token, userId) =>
                            new Promise((resolve, reject) => {
                              request
                                .get(`https://${config('AUTH0_DOMAIN')}/api/v2/user-blocks/${userId}`)
                                .set('Authorization', `Bearer ${token}`)
                          Severity: Minor
                          Found in server/lib/userBlocks.js - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function useConnectionsField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const useConnectionsField = (isEditField, fields, connections, onConnectionChange) => {
                            const type = isEditField ? 'edit' : 'create';
                            // if we have exactly one connection then don't show this field and use that connection
                            // however if we have zero connections, we should show the free text connections field
                            if (!connections || connections.length === 1) {
                          Severity: Minor
                          Found in client/utils/useDefaultFields.js - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Severity
                          Category
                          Status
                          Source
                          Language