Showing 165 of 254 total issues

Function Profile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const Profile: FunctionComponent = () => {
  const toast = useToast();
  const { profileStore, userStore } = useContext(ServerContext);
  const [name, setName] = useState<string>('');
  const [email, setEmail] = useState<string>('');
Severity: Minor
Found in new-client/src/components/Profile.tsx - 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 handlePrivmsg has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

async function handlePrivmsg(user, msg, command) {
  // :ilkkao!~ilkkao@127.0.0.1 NOTICE buppe :foo
  const target = msg.params[0];
  const currentNick = await nicksService.getNick(user.gId, msg.network);
  let conversation;
Severity: Minor
Found in server/backends/irc/controller.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 init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  init(args) {
    this._super(args);

    const message = this.message;

Severity: Minor
Found in client/app/pods/components/discussion-message/component.js - About 1 hr to fix

    Function log has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      log({ level, message, ...meta }, callback) {
        const [, processName, processExtension] = process.title.split('-');
        let processColumn;
        let cat;
    
    
    Severity: Minor
    Found in server/lib/winstonMasTransport.ts - About 1 hr to fix

      Function exports has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(defaults) {
        const app = new EmberApp(defaults, {
          sourcemaps: {
            enabled: true
          },
      Severity: Minor
      Found in client/ember-cli-build.js - About 1 hr to fix

        Function constructor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor({ gid, body, doc, category, timestamp, updatedTimestamp, user, window, status }: MessageModelProps) {
            this.gid = gid;
            this.body = body || '';
            this.doc = doc;
            this.category = category;
        Severity: Minor
        Found in new-client/src/models/Message.ts - About 1 hr to fix

          Function Search has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Search: FunctionComponent = () => {
            const navigate = useNavigate();
            const toast = useToast();
            const { windowStore } = useContext(ServerContext);
            const [name, setName] = useState<string>('');
          Severity: Minor
          Found in new-client/src/components/JoinChannel.tsx - About 1 hr to fix

            Function _drawCursor has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _drawCursor(cursor) {
                if (cursor.x === null) {
                  $('#window-cursor').hide();
                  return;
                }
            Severity: Minor
            Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

              Function Search has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Search: FunctionComponent = () => {
                const navigate = useNavigate();
                const toast = useToast();
                const { windowStore } = useContext(ServerContext);
                const [name, setName] = useState<string>('');
              Severity: Minor
              Found in new-client/src/components/CreateChannel.tsx - About 1 hr to fix

                Function createExt has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.createExt = async function createExt(ctx) {
                  const form = await decodeForm(ctx.req, registrationFormExt);
                
                  async function renderForm() {
                    await ctx.render('register-ext', {
                Severity: Minor
                Found in server/controllers/register.js - About 1 hr to fix

                  Function init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    init(args) {
                      this._super(args);
                  
                      this.content = EmberObject.create();
                  
                  
                  Severity: Minor
                  Found in client/app/pods/components/discussion-window/component.js - About 1 hr to fix

                    Function handleSendText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      handleSendText({ window = mandatory(), text = mandatory() }) {
                        let sent = false;
                    
                        setTimeout(() => {
                          if (!sent) {
                    Severity: Minor
                    Found in client/app/stores/WindowStore.js - About 1 hr to fix

                      Function _layoutWindows has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        _layoutWindows(animate) {
                          const duration = animate ? 600 : 0;
                          const windowComponents = this.windowComponents;
                          const container = this._containerDimensions();
                          const expandedWindow = windowComponents.findBy('expanded', true);
                      Severity: Minor
                      Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

                        Function _lineAdded has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _lineAdded(message) {
                            if (!message || !windowStore.initDone) {
                              return;
                            }
                        
                        
                        Severity: Minor
                        Found in client/app/pods/components/discussion-window/component.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 setters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                          static get setters() {
                            return {
                              name: function name(realName) {
                                if (!realName || realName.length < 6) {
                                  return { valid: false, error: 'Please enter at least 6 characters.' };
                        Severity: Minor
                        Found in server/models/user.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 _lineAdded has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _lineAdded(message) {
                            if (!message || !windowStore.initDone) {
                              return;
                            }
                        
                        
                        Severity: Minor
                        Found in client/app/pods/components/discussion-window/component.js - About 1 hr to fix

                          Function setupTransporter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function setupTransporter() {
                            if (get('mailgun:enabled')) {
                              const mailgun = require('nodemailer-mailgun-transport'); // Slow module to require
                              const mailgunAuth = {
                                auth: {
                          Severity: Minor
                          Found in server/lib/mailer.ts - About 1 hr to fix

                            Function renderMessage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const renderMessage = () => {
                                const color = message.isFromMe ? 'blue.600' : undefined;
                                const nickColor = message.isFromMe ? 'blue.600' : '#617eb5';
                            
                                if (editedBody) {
                            Severity: Minor
                            Found in new-client/src/components/MessageRenderer.tsx - About 1 hr to fix

                              Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                constructor(rootStore: RootStore, socket: Socket) {
                                  this.rootStore = rootStore;
                                  this.socket = socket;
                              
                                  makeObservable(this, {
                              Severity: Minor
                              Found in new-client/src/stores/WindowStore.ts - About 1 hr to fix

                                Function createInputRules has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  createInputRules(): InputRule[] {
                                    const getUniCodeEmoji = (text: string) => {
                                      const emojis = emojiIndex.search(text.replace(/^:(.+):$/, (_match, name) => name));
                                
                                      if (!emojis || emojis.length === 0) {
                                Severity: Minor
                                Found in new-client/src/lib/remirrorMessageEmojiExtension.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language