Showing 37 of 37 total issues

Method start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

public void start() {
Thread thread = new Thread(() -> {
status = context.getString(R.string.decrypting_data);
File tempDecryptedFile = new File(context.getCacheDir(), randomUUID().toString());
 
 

Method updateEncryptedData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public void updateEncryptedData() {
NotesDB db = getNotesDB();
 
NoteTable noteTable = getNoteTable();
FileInfoTable fileInfoTable = getFileInfoTable();

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

    private void fillFilesListView(List<FileInfo> filesInfo) {
    ListView filesView = findViewById(R.id.filesListView);
    TextView missingFilesLabel = findViewById(R.id.missingFilesLabel);
     
    if (!filesInfo.isEmpty()) {
    app/src/main/java/app/notesr/activity/notes/NoteListActivity.java on lines 113..126

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

    private void fillNotesListView(List<Note> notes) {
    ListView notesView = findViewById(R.id.notesListView);
    TextView missingNotesLabel = findViewById(R.id.missingNotesLabel);
     
    if (!notes.isEmpty()) {
    app/src/main/java/app/notesr/activity/files/FileListActivity.java on lines 125..138

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

    public boolean isAnyActivityVisible() {
    ActivityManager activityManager = (ActivityManager)
    context.getSystemService(Context.ACTIVITY_SERVICE);
     
    if (activityManager != null) {
    Severity: Minor
    Found in app/src/main/java/app/notesr/App.java - About 1 hr to fix

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

    @Override
    public void run() {
    try {
    while (thread.isAlive()) {
    if (!FileViewerActivityBase.isRunning()) {

    Method onCreateOptionsMenu has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    EditText nameField = findViewById(R.id.noteNameField);
    EditText textField = findViewById(R.id.noteTextField);
     
     
    Severity: Minor
    Found in app/src/main/java/app/notesr/activity/notes/OpenNoteActivity.java - About 1 hr to fix

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

      public void authorize() {
      String password = passwordBuilder.toString();
       
      CryptoManager cryptoManager = App.getAppContainer().getCryptoManager();
      TextView censoredPasswordView = activity.findViewById(R.id.censoredPasswordTextView);

        Method decryptInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        public static FileInfo decryptInfo(EncryptedFileInfo encryptedFileInfo, CryptoKey cryptoKey) {
        Aes aes = new Aes(cryptoKey.getKey(), cryptoKey.getSalt());
         
        try {
        byte[] encryptedName = encryptedFileInfo.getEncryptedName();
        Severity: Minor
        Found in app/src/main/java/app/notesr/crypto/FileCrypt.java - About 1 hr to fix

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

          public static Note decrypt(EncryptedNote encryptedNote, CryptoKey cryptoKey) {
          String name = decryptValue(encryptedNote.getEncryptedName(), cryptoKey);
          String text = decryptValue(encryptedNote.getEncryptedText(), cryptoKey);
           
          Note note = new Note(name, text);
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/NoteCrypt.java and 1 other location - About 1 hr to fix
          app/src/main/java/app/notesr/crypto/NoteCrypt.java on lines 34..43

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

          public static EncryptedNote encrypt(Note note, CryptoKey cryptoKey) {
          byte[] encryptedName = encryptValue(note.getName(), cryptoKey);
          byte[] encryptedText = encryptValue(note.getText(), cryptoKey);
           
          EncryptedNote encryptedNote = new EncryptedNote(encryptedName, encryptedText);
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/NoteCrypt.java and 1 other location - About 1 hr to fix
          app/src/main/java/app/notesr/crypto/NoteCrypt.java on lines 45..54

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

          public void authorize() {
          String password = passwordBuilder.toString();
           
          CryptoManager cryptoManager = App.getAppContainer().getCryptoManager();
          TextView censoredPasswordView = activity.findViewById(R.id.censoredPasswordTextView);

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

          private View.OnClickListener importKeyButtonOnClick() {
          return view -> {
          String hexKey = keyField.getText().toString();
           
          if (!hexKey.isBlank()) {
          Severity: Minor
          Found in app/src/main/java/app/notesr/activity/security/ImportKeyActivity.java - About 55 mins to fix

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

          private Runnable wipeFile(TempFile tempFile) {
          return () -> {
          File file = new File(Objects.requireNonNull(tempFile.getUri().getPath()));
           
          if (file.exists()) {
          Severity: Minor
          Found in app/src/main/java/app/notesr/service/android/CacheCleanerService.java - About 55 mins to fix

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

          public static byte[] decryptData(byte[] data, CryptoKey cryptoKey) {
          try {
          Aes aes = new Aes(cryptoKey.getKey(), cryptoKey.getSalt());
          return aes.decrypt(data);
          } catch (Exception e) {
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/FileCrypt.java and 1 other location - About 45 mins to fix
          app/src/main/java/app/notesr/crypto/FileCrypt.java on lines 50..58

          Method onCreate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
           
           
          Severity: Minor
          Found in app/src/main/java/app/notesr/activity/MainActivity.java - About 45 mins to fix

          Method proceedPasswordSetting has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          private String proceedPasswordSetting() {
          String password = passwordBuilder.toString();
          TextView topLabel = activity.findViewById(R.id.authTopLabel);
           
          if (createdPassword == null) {

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

          public static byte[] encryptData(byte[] data, CryptoKey cryptoKey) {
          try {
          Aes aes = new Aes(cryptoKey.getKey(), cryptoKey.getSalt());
          return aes.encrypt(data);
          } catch (Exception e) {
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/FileCrypt.java and 1 other location - About 45 mins to fix
          app/src/main/java/app/notesr/crypto/FileCrypt.java on lines 60..68

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

          return EncryptedFileInfo.builder()
          .id(fileInfo.getId())
          .noteId(fileInfo.getNoteId())
          .size(fileInfo.getSize())
          .encryptedName(name)
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/FileCrypt.java and 1 other location - About 40 mins to fix
          app/src/main/java/app/notesr/crypto/FileCrypt.java on lines 124..133

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

          return FileInfo.builder()
          .id(encryptedFileInfo.getId())
          .noteId(encryptedFileInfo.getNoteId())
          .size(encryptedFileInfo.getSize())
          .name(decryptedName)
          Severity: Minor
          Found in app/src/main/java/app/notesr/crypto/FileCrypt.java and 1 other location - About 40 mins to fix
          app/src/main/java/app/notesr/crypto/FileCrypt.java on lines 87..96
          Severity
          Category
          Status
          Source
          Language