Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat code with Intelij tool #741

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Install Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

- name: Override link[WORKAROUND] # Looks that this is a bug with current homebrew or Github CI
- name: Override link[WORKAROUND] # Looks that this is a bug with current homebrew or GitHub CI
run: rm '/usr/local/bin/2to3'

- name: Install GTK4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

# Duplicate finder checks included and excluded directories
# Others are just check delete files number
# Windows build have some elements changed like powershell before wget and unzip, python instead python3, rm -r instead rm -r and one (at the top) additional test which check size of characyers
# Windows build have some elements changed like powershell before wget and unzip, python instead python3, rm -r instead rm -r and one (at the top) additional test which check size of characters
- name: test
run: |
powershell wget https://github.com/qarmin/czkawka/releases/download/1.1.0/TestSuite.zip -O TestSuite.zip
Expand Down
18 changes: 9 additions & 9 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- Resize preview with window - [#466](https://github.com/qarmin/czkawka/pull/466)
- Fix removing only one item from list view - [#466](https://github.com/qarmin/czkawka/pull/466)
- Fix showing help command in duplicate CLI mode - [#720](https://github.com/qarmin/czkawka/pull/720)
- Fix freeze when not choosing any tag in similiar music mode - [TODO]()
- Fix freeze when not choosing any tag in similar music mode - [TODO]()
- Read more tags from music files - [#705](https://github.com/qarmin/czkawka/pull/705)
- Improve checking for invalid extensions - [#705](https://github.com/qarmin/czkawka/pull/705)
- Support for finding invalid PDF files - [#705](https://github.com/qarmin/czkawka/pull/705)
Expand Down Expand Up @@ -38,7 +38,7 @@
- Change minimal supported OS to Ubuntu 20.04(needed by GTK) - [#468](https://github.com/qarmin/czkawka/pull/468)
- Increased performance by avoiding creating unnecessary image previews - [#468](https://github.com/qarmin/czkawka/pull/468)
- Improved performance due caching hash of broken/not supported images/videos = [#471](https://github.com/qarmin/czkawka/pull/471)
- Option to not remove cache from non existent files(e.g. from unplugged pendrive) - [#472](https://github.com/qarmin/czkawka/pull/472)
- Option to not remove cache from non-existent files(e.g. from unplugged pendrive) - [#472](https://github.com/qarmin/czkawka/pull/472)
- Add multiple tooltips with helpful messages - [#472](https://github.com/qarmin/czkawka/pull/472)
- Allow caching prehash - [#477](https://github.com/qarmin/czkawka/pull/477)
- Improve custom selecting of records(allows to use Rust regex) - [#489](https://github.com/qarmin/czkawka/pull/478)
Expand All @@ -63,7 +63,7 @@
- Add additional info to printed errors [#446](https://github.com/qarmin/czkawka/pull/446)
- Add support for multiple image filters, hashes and sizes in similar images tool [#447](https://github.com/qarmin/czkawka/pull/447), [#448](https://github.com/qarmin/czkawka/pull/448)
- Button to move files/folders to provided location [#449](https://github.com/qarmin/czkawka/pull/449)
- Add non clickable button to fix white theme [#450](https://github.com/qarmin/czkawka/pull/450)
- Add non-clickable button to fix white theme [#450](https://github.com/qarmin/czkawka/pull/450)
- Fixed freeze when opening in same thread file/folder [#448](https://github.com/qarmin/czkawka/pull/448)
- Tool to check performance of different image filters and hash types and sizes [#447](https://github.com/qarmin/czkawka/pull/447)
- Add scheduled CI and pin it to support Rust 1.53.0 [7bb](https://github.com/qarmin/czkawka/commit/7bbdf742739a513b80d0cc06ba61dfafec976b23), [#431](https://github.com/qarmin/czkawka/pull/431)
Expand Down Expand Up @@ -123,7 +123,7 @@
- Add support for CRC32 and XXH3 hash - [#243](https://github.com/qarmin/czkawka/pull/243)
- Add delete method to replace duplicate files with hard links - [#236](https://github.com/qarmin/czkawka/pull/236)
- Add checking for broken music opt-in - [#249](https://github.com/qarmin/czkawka/pull/249)
- Allow to save to files similar images results - [10156ccfd3](https://github.com/qarmin/czkawka/commit/10156ccfd3ba880d26d4bbad1e025b0050d7753b)
- Allow to save to file similar images results - [10156ccfd3](https://github.com/qarmin/czkawka/commit/10156ccfd3ba880d26d4bbad1e025b0050d7753b)
- Keep original file if replacing duplicate with hardlink fails - [#256](https://github.com/qarmin/czkawka/pull/256)
- Fix Windows theme - [#265](https://github.com/qarmin/czkawka/pull/265)
- Windows taskbar progress support - [#264](https://github.com/qarmin/czkawka/pull/264)
Expand Down Expand Up @@ -169,7 +169,7 @@ This version is only needed to test flatpak build
- Add support for delete button - [#159](https://github.com/qarmin/czkawka/pull/159)
- Allow to select multiple entries in File Chooser - [#154](https://github.com/qarmin/czkawka/pull/154)
- Add cache support for similar images - [#139](https://github.com/qarmin/czkawka/pull/139)
- Add selecting images with it's size - [#138](https://github.com/qarmin/czkawka/pull/138)
- Add selecting images with its size - [#138](https://github.com/qarmin/czkawka/pull/138)
- Modernize popovers code and simplify later changes - [#137](https://github.com/qarmin/czkawka/pull/137)

## Version 2.0.0 - 23.12.2020r
Expand Down Expand Up @@ -213,7 +213,7 @@ This version is only needed to test flatpak build

## Version 1.3.0 - 02.11.2020r
- Appimage support - [#77](https://github.com/qarmin/czkawka/pull/77)
- Removed warnings about non existend excluded directories - [#79](https://github.com/qarmin/czkawka/pull/79)
- Removed warnings about non-existed excluded directories - [#79](https://github.com/qarmin/czkawka/pull/79)
- Updated README - [8ec](https://github.com/qarmin/czkawka/commit/8ecde0fc9adb3e6cedf432c4ba749e698b645a7a)
- Added pre hash support(speedup for searching big duplicates) - [#83](https://github.com/qarmin/czkawka/pull/83)
- Support for searching duplicates by file name - [#84](https://github.com/qarmin/czkawka/pull/84)
Expand Down Expand Up @@ -247,7 +247,7 @@ This version is only needed to test flatpak build

## Version 1.0.1 - 06.10.2020r
- Replaced default argument parser with StructOpt [#37](https://github.com/qarmin/czkawka/pull/37)
- Added all(except MacOS GTK build) builds to CI where can be freely downloaded [#41](https://github.com/qarmin/czkawka/pull/41) [#39](https://github.com/qarmin/czkawka/pull/39)
- Added all(except macOS GTK build) builds to CI where can be freely downloaded [#41](https://github.com/qarmin/czkawka/pull/41) [#39](https://github.com/qarmin/czkawka/pull/39)
- App can be downloaded also from Arch AUR and Cargo [#36](https://github.com/qarmin/czkawka/pull/36)
- Fixed crash with invalid file modification date [#33](https://github.com/qarmin/czkawka/issues/33)
- Upper tabs can hide and show when this is necessary [#38](https://github.com/qarmin/czkawka/pull/38)
Expand Down Expand Up @@ -298,11 +298,11 @@ This version is only needed to test flatpak build
- Basic search in GTK
- Cleaned core from println
- Core functions doesn't use now process::exit(everything is done with help of messages/errors/warnings)
- Added support for non recursive search
- Added support for non-recursive search
- Improved finding number and size of duplicated files
- Saving results to file
- Print how much data was read by duplicate finder(debug only)
- Added Github CI
- Added GitHub CI
- Only debug build prints debug information's
- Clean code
- Add basic idea config to misc folder
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Czkawka** (_tch•kav•ka_ (IPA: [ʈ͡ʂkafka]), "hiccup" in Polish) is a simple, fast and free app to remove unnecessary files from your computer.

## UNSTABLE WARNING
**Currently master branch of this repository contains unstable GTK 4 port, so multiple regression, broken features etc. are expected.**
**Currently, master branch of this repository contains unstable GTK 4 port, so multiple regression, broken features etc. are expected.**

**You can use old stable version built with GTK 3 - [4.1.0](https://github.com/qarmin/czkawka/releases/tag/4.1.0) or compile app from git before GTK 4 PR merge.**

Expand Down Expand Up @@ -50,7 +50,7 @@ If you want to try and develop Czkawka or just use the latest available feature,

Since Czkawka is written in Rust and it aims to be a faster alternative to FSlint or DupeGuru which are written in Python, we need to compare the speed of these tools.

I tested it on a 256 GB SSD and a i7-4770 CPU.
I tested it on a 256 GB SSD and an i7-4770 CPU.

I prepared a disk and performed a test without any folder exceptions and with disabled ignoring of hard links. The disk contained 363 215 files, took 221,8 GB and had 62093 duplicate files in 31790 groups which occupied 4,1 GB.

Expand Down Expand Up @@ -135,7 +135,7 @@ There are many similar applications to Czkawka on the Internet, which do some th
### CLI
Due to limited time, the biggest emphasis is on the GUI version so if you are looking for really good and feature-packed console apps, then take a look at these:
- [Fclones](https://github.com/pkolaczk/fclones) - One of the fastest tools to find duplicates; it is written also in Rust
- [Rmlint](https://github.com/sahib/rmlint) - Really good console interface and also is feature packed
- [Rmlint](https://github.com/sahib/rmlint) - Nice console interface and also is feature packed
- [RdFind](https://github.com/pauldreik/rdfind) - Fast, but written in C++ ¯\\\_(ツ)\_/¯

## Contributions
Expand Down Expand Up @@ -185,7 +185,7 @@ Big thanks to Pádraig Brady, creator of fantastic FSlint, because without his w

Thanks also to all the people who create patches for this program, make it available on other systems, create videos, articles about it etc.

Also I really appreciate work of people that create crates on which Czkawka is based and for that I try to report bugs to make it even better.
Also, I really appreciate work of people that create crates on which Czkawka is based and for that I try to report bugs to make it even better.

## Donations
If you are using the app, I would appreciate a donation for its further development, which can be done [here](https://github.com/sponsors/qarmin).
2 changes: 1 addition & 1 deletion czkawka_cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ pub struct NotRecursive {
#[cfg(target_family = "unix")]
#[derive(Debug, StructOpt)]
pub struct ExcludeOtherFilesystems {
#[structopt(short = "X", long, help = "Exclude files on other filesystmes")]
#[structopt(short = "X", long, help = "Exclude files on other filesystems")]
pub exclude_other_filesystems: bool,
}

Expand Down
1 change: 1 addition & 0 deletions czkawka_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use czkawka_core::{

mod commands;

//noinspection ALL
fn main() {
let command = Commands::from_args();

Expand Down
3 changes: 2 additions & 1 deletion czkawka_core/src/bad_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static WORKAROUNDS: &[(&str, &str)] = &[
("xml", "xba"), // Libreoffice
("xml", "xcd"), // Libreoffice files
("zip", "apk"), // Android apk
("zip", "cbr"), // Komiksy
("zip", "cbr"), // Comics
("zip", "dat"), // Multiple - python, brave
("zip", "doc"), // Word
("zip", "docx"), // Word
Expand Down Expand Up @@ -132,6 +132,7 @@ pub struct BadFileEntry {
pub current_extension: String,
pub proper_extensions: String,
}

/// Info struck with helpful information's about results
#[derive(Default)]
pub struct Info {
Expand Down
2 changes: 1 addition & 1 deletion czkawka_core/src/big_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl DebugPrint for BigFile {
println!("Excluded directories - {:?}", self.directories.excluded_directories);
println!("Recursive search - {}", self.recursive_search);
#[cfg(target_family = "unix")]
println!("Skip other filesystmes - {}", self.directories.exclude_other_filesystems());
println!("Skip other filesystems - {}", self.directories.exclude_other_filesystems());
println!("Number of files to check - {:?}", self.number_of_files_to_check);
println!("-----------------------------------------");
}
Expand Down
14 changes: 7 additions & 7 deletions czkawka_core/src/broken_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,16 @@ impl BrokenFiles {
Some(Some(file_entry_clone))
}
}
TypeOfFile::ArchiveZip => match fs::File::open(&file_entry.path) {
TypeOfFile::ArchiveZip => match File::open(&file_entry.path) {
Ok(file) => {
if let Err(e) = zip::ZipArchive::new(file) {
file_entry.error_string = e.to_string();
}
Some(Some(file_entry))
},
}
Err(_inspected) => Some(None)
},
TypeOfFile::Audio => match fs::File::open(&file_entry.path) {
TypeOfFile::Audio => match File::open(&file_entry.path) {
Ok(file) =>
{
let mut file_entry_clone = file_entry.clone();
Expand All @@ -481,7 +481,7 @@ impl BrokenFiles {
file_entry_clone.error_string = "Audio crashes due parsing, please report bug here - https://github.com/qarmin/audio_checker/issues".to_string();
Some(Some(file_entry_clone))
}
},
}
Err(_inspected) => Some(None),
},

Expand All @@ -502,7 +502,7 @@ impl BrokenFiles {
if let Err(e) = pdf::file::File::from_data(content) {
file_entry.error_string = e.to_string();
let error = unpack_pdf_error(e);
if let pdf::PdfError::InvalidPassword = error {
if let PdfError::InvalidPassword = error {
return Some(None);
}
}
Expand All @@ -515,7 +515,7 @@ impl BrokenFiles {
file_entry_clone.error_string = "PDF-rs library crashed when opening pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf".to_string();
Some(Some(file_entry_clone))
}
},
}
Err(_inspected) => Some(None)
}
}
Expand Down Expand Up @@ -615,7 +615,7 @@ impl DebugPrint for BrokenFiles {
println!("Excluded directories - {:?}", self.directories.excluded_directories);
println!("Recursive search - {}", self.recursive_search);
#[cfg(target_family = "unix")]
println!("Skip other filesystmes - {}", self.directories.exclude_other_filesystems());
println!("Skip other filesystems - {}", self.directories.exclude_other_filesystems());
println!("Delete Method - {:?}", self.delete_method);
println!("-----------------------------------------");
}
Expand Down
9 changes: 5 additions & 4 deletions czkawka_core/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use directories_next::ProjectDirs;
use image::{DynamicImage, ImageBuffer, Rgb};
use imagepipe::{ImageSource, Pipeline};
use std::ffi::OsString;
use std::fs;
use std::fs::{File, OpenOptions};
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::time::SystemTime;

use directories_next::ProjectDirs;
use image::{DynamicImage, ImageBuffer, Rgb};
use imagepipe::{ImageSource, Pipeline};

/// Class for common functions used across other class/functions
pub const RAW_IMAGE_EXTENSIONS: &[&str] = &[
".mrw", ".arw", ".srf", ".sr2", ".mef", ".orf", ".srw", ".erf", ".kdc", ".kdc", ".dcs", ".rw2", ".raf", ".dcr", ".dng", ".pef", ".crw", ".iiq", ".3fr", ".nrw", ".nef", ".mos",
Expand Down Expand Up @@ -136,7 +137,7 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef<Path> + std::fmt::Debug
};

// println!("Properly hashed {:?}", path);
Some(image::DynamicImage::ImageRgb8(image))
Some(DynamicImage::ImageRgb8(image))
}

impl Common {
Expand Down
5 changes: 3 additions & 2 deletions czkawka_core/src/common_dir_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use std::thread::sleep;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::{fs, thread};

use crate::common::LOOP_DURATION;
use crossbeam_channel::Receiver;
use rayon::prelude::*;

use crate::common::LOOP_DURATION;
use crate::common_directory::Directories;
use crate::common_extensions::Extensions;
use crate::common_items::ExcludedItems;
Expand Down Expand Up @@ -72,7 +72,8 @@ pub(crate) enum FolderEmptiness {
/// Struct assigned to each checked folder with parent path(used to ignore parent if children are not empty) and flag which shows if folder is empty
#[derive(Clone)]
pub struct FolderEntry {
pub(crate) parent_path: Option<PathBuf>, // Usable only when finding
pub(crate) parent_path: Option<PathBuf>,
// Usable only when finding
pub(crate) is_empty: FolderEmptiness,
pub modified_date: u64,
}
Expand Down
3 changes: 2 additions & 1 deletion czkawka_core/src/duplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ impl DebugPrint for DuplicateFinder {
println!("Excluded directories - {:?}", self.directories.excluded_directories);
println!("Recursive search - {}", self.recursive_search);
#[cfg(target_family = "unix")]
println!("Skip other filesystmes - {}", self.directories.exclude_other_filesystems());
println!("Skip other filesystems - {}", self.directories.exclude_other_filesystems());
println!("Minimum file size - {:?}", self.minimal_file_size);
println!("Checking Method - {:?}", self.check_method);
println!("Delete Method - {:?}", self.delete_method);
Expand Down Expand Up @@ -1306,6 +1306,7 @@ pub fn save_hashes_to_file(hashmap: &BTreeMap<String, FileEntry>, text_messages:
.push(flc!("core_saving_to_cache", generate_translation_hashmap(vec![("number", how_much.to_string())])));
}
}

pub fn load_hashes_from_file(text_messages: &mut Messages, delete_outdated_cache: bool, type_of_hash: &HashType, is_prehash: bool) -> Option<BTreeMap<u64, Vec<FileEntry>>> {
if let Some(((file_handler, cache_file), (_json_file, _json_name))) =
open_cache_folder(&get_file_hash_name(type_of_hash, is_prehash), false, false, &mut text_messages.warnings)
Expand Down
2 changes: 1 addition & 1 deletion czkawka_core/src/empty_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl DebugPrint for EmptyFiles {
println!("Excluded directories - {:?}", self.directories.excluded_directories);
println!("Recursive search - {}", self.recursive_search);
#[cfg(target_family = "unix")]
println!("Skip other filesystmes - {}", self.directories.exclude_other_filesystems());
println!("Skip other filesystems - {}", self.directories.exclude_other_filesystems());
println!("Delete Method - {:?}", self.delete_method);
println!("-----------------------------------------");
}
Expand Down
2 changes: 1 addition & 1 deletion czkawka_core/src/invalid_symlinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl DebugPrint for InvalidSymlinks {
println!("Excluded directories - {:?}", self.directories.excluded_directories);
println!("Recursive search - {}", self.recursive_search);
#[cfg(target_family = "unix")]
println!("Skip other filesystmes - {}", self.directories.exclude_other_filesystems());
println!("Skip other filesystems - {}", self.directories.exclude_other_filesystems());
println!("Delete Method - {:?}", self.delete_method);
println!("-----------------------------------------");
}
Expand Down
1 change: 1 addition & 0 deletions czkawka_core/src/localizer_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub fn generate_translation_hashmap(vec: Vec<(&'static str, String)>) -> HashMap
pub fn fnc_get_similarity_very_high() -> String {
flc!("core_similarity_very_high")
}

pub fn fnc_get_similarity_minimal() -> String {
flc!("core_similarity_minimal")
}
Loading