LarryHsiao/Nyx

View on GitHub

Showing 49 of 153 total issues

Method value has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public String value() {
        try {
            final HttpURLConnection conn =
                ((HttpURLConnection) new URL(URL_TOKEN).openConnection());

    Method value has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        override fun value(): Metadata {
            db.value().prepareStatement(
                // language=H2
                """//
    UPDATE METADATA

      Method fire has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void fire() {
              final List<Attachment> remoteUpdates = new ArrayList<>();
              final Map<Long, Attachment> localUpdates = nyx.attachments()
                  .all()

      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

      Method fire has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void fire() {
              final List<Jot> remoteUpdates = new ArrayList<>();
              final Map<Long, Jot> localJotMap = nyx.jots().all()
                  .stream()
      Severity: Minor
      Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncJotsAction.java - 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

      Method value has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          override fun value(): Jot {
              val sameGroupJots = QueriedJots(
                  JotsByTimestampRange(
                      db,
                      Calendar.getInstance().apply {

        Method fire has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void fire() {
                final List<Jot> remoteUpdates = new ArrayList<>();
                final Map<Long, Jot> localJotMap = nyx.jots().all()
                    .stream()
        Severity: Minor
        Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncJotsAction.java - About 1 hr to fix

          Method fire has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override fun fire() {
                  val cursorPosition = textView.selectionStart
                  val spannable = SpannableString(content)
                  tags.keys.forEach { tagName ->
                      try {

            Method onViewCreated has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
                    super.onViewCreated(view, savedInstanceState);
                    RecyclerView listView = view.findViewById(R.id.list);
                    listView.setBackgroundColor(Color.BLACK);

              Method onBindVideo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void onBindVideo(Uri uri, ViewHolder holder) {
                      ImageView imageView =
                          holder.itemView.findViewById(R.id.itemAttachmentVideo_icon);
                      if (new IsLocalExist(context, uri.toString()).value()) {
                          MediaMetadataRetriever mmr = new MediaMetadataRetriever();

                Method fire has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public void fire() {
                        FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
                        if (uri.startsWith(URI_FILE_PROVIDER) &&
                            !new IsLocalExist(image.getContext(), uri).value() &&
                Severity: Minor
                Found in app/src/main/java/com/larryhsiao/nyx/attachment/ImageLoading.java - About 1 hr to fix

                  Method value has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      override fun value(): List<RankedMood> {
                          val result: MutableMap<String?, Int> = HashMap()
                          for (jot in QueriedJots(AllJots(db)).value()) {
                              if (jot.mood().length < 2 || jot.mood().substring(0, 1).contains(" ")) {
                                  continue

                    Method value has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        override fun value(): Connection {
                            return try {
                                val conn = connSource.value()
                                conn.createStatement().executeUpdate( // language=H2
                                    """//---
                    Severity: Minor
                    Found in core/src/main/java/com/larryhsiao/nyx/core/tags/TagDb.kt - About 1 hr to fix

                      Method sync has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          public void sync() {
                              try {
                                  if (isSyncing) {
                                      return;
                      Severity: Minor
                      Found in core/src/main/java/com/larryhsiao/nyx/core/sync/SyncImpl.java - About 1 hr to fix

                        Method fire has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            public void fire() {
                                try (final PreparedStatement stmt = db.value().prepareStatement(
                                    // language=H2
                                    "INSERT INTO jots(ID, content, createdTime, location, mood, VERSION, TITLE, PRIVATE, delete)\n" +

                          Method value has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              override fun value(): Jot {
                                  try {
                                      db.value().prepareStatement( // language=H2
                                          "SELECT * FROM jots WHERE id=?;"
                                      ).use { stmt ->
                          Severity: Minor
                          Found in core/src/main/java/com/larryhsiao/nyx/core/jots/JotById.kt - About 1 hr to fix

                            Method loginSuccessHtml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private String loginSuccessHtml(){
                                    return  "<!DOCTYPE html>\n" +
                                        "<html>\n" +
                                        "  \n" +
                                        "<body>\n" +
                            Severity: Minor
                            Found in app/src/main/java/com/larryhsiao/nyx/syncs/CallBackServer.java - About 1 hr to fix

                              Method onBindPreview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void onBindPreview(Uri uri, ViewHolder holder) {
                                      RichPreview preview = new RichPreview(new ResponseListener() {
                                          @Override
                                          public void onData(MetaData metaData) {
                                              final View root = holder.getRootView();

                                Method value has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    override fun value(): Metadata {
                                        db.value().prepareStatement(
                                            """//
                                INSERT INTO METADATA(TYPE, TITLE, VALUE, JOT_ID, VALUE_DECIMAL, COMMENT)
                                values (?, ?, ?, ?, ?, ?)""",

                                  Method fire has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      @Override
                                      public void fire() {
                                          try {
                                              final InputStream stream = streamSource.value();
                                              final HttpURLConnection conn = (HttpURLConnection) new URL(URL).openConnection();

                                  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

                                  Method updateRemoteFiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private void updateRemoteFiles(List<Attachment> remoteUpdates) {
                                          try {
                                              final List<Future<?>> asyncFuture = new ArrayList<>();
                                              for (Attachment remoteUpdate : remoteUpdates) {
                                                  final File sourceFile = nyx.files().fileByUri(remoteUpdate.uri());

                                  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