Showing 254 of 254 total issues

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

  nick: fields.string({
    required: true,
    label: 'Nickname',
    errorAfterField: true,
    widget: widgets.text({
Severity: Major
Found in server/controllers/register.js and 2 other locations - About 1 hr to fix
server/controllers/register.js on lines 31..42
server/controllers/register.js on lines 43..54

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 68.

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 3 locations. Consider refactoring.
Open

  name: fields.string({
    required: true,
    label: 'Your name',
    errorAfterField: true,
    widget: widgets.text({
Severity: Major
Found in server/controllers/register.js and 2 other locations - About 1 hr to fix
server/controllers/register.js on lines 43..54
server/controllers/register.js on lines 78..89

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 68.

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 3 locations. Consider refactoring.
Open

  email: fields.string({
    required: true,
    label: 'Email address',
    errorAfterField: true,
    widget: widgets.text({
Severity: Major
Found in server/controllers/register.js and 2 other locations - About 1 hr to fix
server/controllers/register.js on lines 31..42
server/controllers/register.js on lines 78..89

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 68.

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

Function setters has 40 lines of code (exceeds 25 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

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

      get sortedLogMessages(): Array<MessageModel> {
        return Array.from(this.logMessages.values()).sort((a, b) => a.timestamp - b.timestamp);
      }
    Severity: Major
    Found in new-client/src/models/Window.ts and 1 other location - About 1 hr to fix
    new-client/src/models/Window.ts on lines 156..158

    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 67.

    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

      get sortedMessages(): Array<MessageModel> {
        return Array.from(this.messages.values()).sort((a, b) => a.timestamp - b.timestamp);
      }
    Severity: Major
    Found in new-client/src/models/Window.ts and 1 other location - About 1 hr to fix
    new-client/src/models/Window.ts on lines 160..162

    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 67.

    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

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

      _markWindow(masWindow, x, y, cursor) {
        masWindow.cursor = 'none';
    
        const rowCount = this.dimensions.length;
        const columnCount = this.dimensions[y].length;
    Severity: Minor
    Found in client/app/pods/components/window-grid/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 parseIrcMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    async function parseIrcMessage({ userId, line, network }) {
      const parts = line.trim().split(' ');
      const msg = {
        params: [],
        numericReply: false,
    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 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 handleUpdate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    async function handleUpdate({ user, command, window, session }) {
      const accepted = ['row', 'column', 'minimizedNamesList', 'desktop'];
      const acceptedAlerts = ['email', 'notification', 'sound', 'title'];
    
      if (!window) {
    Severity: Minor
    Found in server/controllers/request.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 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 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 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 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 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 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 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 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 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
                      Severity
                      Category
                      Status
                      Source
                      Language