before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
private static var licenseURL = URL(string: "https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md")! public var body: some View { VStack(spacing: 32) { VStack(spacing: 0) { Image(nsImage: NSApp.applicationIconImage) .resizable() ...
No issues found.
private static var licenseURL = URL(string: "https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md")! public var body: some View { VStack(spacing: 32) { VStack(spacing: 0) { Image(nsImage: NSApp.applicationIconImage) .resizable() ...
@@ -9,6 +9,7 @@ import SwiftUI public struct AboutView: View { @Environment(\.openURL) private var openURL + @Environment(\.colorScheme) private var colorScheme public init() {} @@ -27,22 +28,26 @@ public struct AboutView: View { private static var licenseURL = URL(string: "https://github.com/C...
CodeEdit/Features/About/Views/AboutView.swift
0
Swift
1
none
16
51
51
true
Made design improvements to About and Acknowledgements windows
1,003
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
.$content .dropFirst() .debounce( for: 0.25, scheduler: DispatchQueue.main ) .sink { _ in codeFile.autosave(withImplicitCancellability: false) { _ in } } .store(in: &cancel...
No issues found.
.$content .dropFirst() .debounce( for: 0.25, scheduler: DispatchQueue.main ) .sink { _ in codeFile.autosave(withImplicitCancellability: false) { _ in } } .store(in: &cancel...
@@ -69,10 +69,26 @@ struct CodeFileView: View { tabWidth: $prefs.preferences.textEditing.defaultTabWidth, lineHeight: $prefs.preferences.textEditing.lineHeightMultiple, wrapLines: $prefs.preferences.textEditing.wrapLinesToEditorWidth, - cursorPosition: codeFile.$cursorP...
CodeEdit/Features/CodeFile/CodeFileView.swift
0
Swift
1
none
16
51
51
true
use theme background
1,004
CodeEditApp/CodeEdit
18,361
Swift
neil-ptr
if self.parent == nil { return "square.dashed.inset.filled" } if self.fileName == ".codeedit" { return "folder.fill.badge.gearshape" } return children.isEmpty ? "folder" : "folder.fill" } /// Returns the file na...
No issues found.
if self.parent == nil { return "square.dashed.inset.filled" } if self.fileName == ".codeedit" { return "folder.fill.badge.gearshape" } return children.isEmpty ? "folder" : "folder.fill" } /// Returns the file na...
@@ -212,7 +212,7 @@ extension WorkspaceClient { /// This function allows creating files in the selected folder or project main directory /// - Parameter fileName: The name of the new file - func addFile(fileName: String) { + func addFile(fileName: String) -> String { // ch...
CodeEdit/Utils/WorkspaceClient/Model/FileItem.swift
0
Swift
1
none
16
51
51
true
Push newly created file into the workspace (#696)
1,057
CodeEditApp/CodeEdit
18,361
Swift
RenanGreca
tappedOpenFile(item) } self.addItem(menuItem) } autoenablesItems = false } @available(*, unavailable) required init(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } /// Only when menu item is highlighted then ...
No issues found.
tappedOpenFile(item) } self.addItem(menuItem) } autoenablesItems = false } @available(*, unavailable) required init(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } /// Only when menu item is highlighted then ...
@@ -1,13 +1,13 @@ // -// BreadcrumbsMenu.swift -// CodeEditModules/Breadcrumbs +// PathBarMenu.swift +// CodeEditModules/PathBar // // Created by Ziyuan Zhao on 2022/3/29. // import AppKit -final class BreadcrumsMenu: NSMenu, NSMenuDelegate { +final class PathBarMenu: NSMenu, NSMenuDelegate { private...
CodeEdit/Features/PathBar/Views/PathBarMenu.swift
0
Swift
1
none
16
51
51
true
Rename `Breadcrumbs` to `PathBar` and fix comments
1,113
CodeEditApp/CodeEdit
18,361
Swift
iggy890
title: "Matching Word", children: [], needSelectionHighlight: true ) static let StartingWith = SearchModeModel( title: "Starting With", children: [], needSelectionHighlight: true ) static let EndingWith = SearchModeModel(title: "Ending With", children: [],...
No issues found.
title: "Matching Word", children: [], needSelectionHighlight: true ) static let StartingWith = SearchModeModel( title: "Starting With", children: [], needSelectionHighlight: true ) static let EndingWith = SearchModeModel(title: "Ending With", children: [],...
@@ -11,56 +11,56 @@ import Foundation struct SearchModeModel { let title: String let children: [SearchModeModel] - let needSelectionHightlight: Bool + let needSelectionHighlight: Bool - static let Containing = SearchModeModel(title: "Containing", children: [], needSelectionHightlight: false) + ...
CodeEdit/Features/Search/Model/SearchModeModel.swift
0
Swift
1
none
16
51
51
true
chore(typos): fix typos
1,121
CodeEditApp/CodeEdit
18,361
Swift
stavares843
self.defaultTabWidth = try container.decodeIfPresent(Int.self, forKey: .defaultTabWidth) ?? 4 self.font = try container.decodeIfPresent(EditorFont.self, forKey: .font) ?? .init() self.enableTypeOverCompletion = try container.decodeIfPresent( Bool.self, ...
No issues found.
self.defaultTabWidth = try container.decodeIfPresent(Int.self, forKey: .defaultTabWidth) ?? 4 self.font = try container.decodeIfPresent(EditorFont.self, forKey: .font) ?? .init() self.enableTypeOverCompletion = try container.decodeIfPresent( Bool.self, ...
@@ -97,7 +97,7 @@ extension AppPreferences { /// Indicates whether or not to use a custom font var customFont: Bool = false - /// The font size for the custom font + /// The font size for the font var size: Int = 12 /// The name of the custom font @@ -117,11 +117,11...
CodeEdit/Features/AppPreferences/Model/Text Editing/TextEditingPreferences.swift
0
Swift
1
none
16
51
51
true
Added setting to change font size, so can now change the default font…
1,128
CodeEditApp/CodeEdit
18,361
Swift
scrapp08
// MARK: - Toolbar func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { [ .toggleFirstSidebarItem, .sidebarTrackingSeparator, .branchPicker, .flexibleSpace, .flexibleSpace, .toggleLastSidebarIte...
No issues found.
// MARK: - Toolbar func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { [ .toggleFirstSidebarItem, .sidebarTrackingSeparator, .branchPicker, .flexibleSpace, .flexibleSpace, .toggleLastSidebarIte...
@@ -110,6 +110,8 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate { inspector.isCollapsed = true inspector.canCollapse = true inspector.collapseBehavior = .useConstraints + inspector.isSpringLoaded = true + splitVC.addSplitViewItem(inspector) ...
CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift
0
Swift
1
none
16
51
51
true
Fix for background color of toolbar in inspector
1,155
CodeEditApp/CodeEdit
18,361
Swift
Wouter01
) ?? .medium self.findNavigatorDetail = try container.decodeIfPresent( NavigatorDetail.self, forKey: .findNavigatorDetail ) ?? .upTo3 self.issueNavigatorDetail = try container.decodeIfPresent( NavigatorDetail.self, ...
No issues found.
) ?? .medium self.findNavigatorDetail = try container.decodeIfPresent( NavigatorDetail.self, forKey: .findNavigatorDetail ) ?? .upTo3 self.issueNavigatorDetail = try container.decodeIfPresent( NavigatorDetail.self, ...
@@ -39,6 +39,10 @@ extension AppPreferences { /// The reopen behavior of the app var reopenBehavior: ReopenBehavior = .welcome + /// Decides what the app does after a workspace is closed + var reopenWindowAfterClose: ReopenWindowBehavior = .doNothing + + /// The size of the proj...
CodeEdit/Features/AppPreferences/Model/General/GeneralPreferences.swift
0
Swift
1
none
16
51
51
true
Add setting to determine what happens after closing the last open workspace
1,194
CodeEditApp/CodeEdit
18,361
Swift
luah5
// // URL+isImage.swift // CodeEdit // // Created by Raymond Vleeshouwer on 14/05/23. // import Foundation extension URL { func isImage() -> Bool { let ext: String = self.pathExtension.lowercased() // A list of supported file types by QLPreviewItem // Some of the image file types (in U...
No issues found.
// // URL+isImage.swift // CodeEdit // // Created by Raymond Vleeshouwer on 14/05/23. // import Foundation extension URL { func isImage() -> Bool { let ext: String = self.pathExtension.lowercased() // A list of supported file types by QLPreviewItem // Some of the image file types (in U...
@@ -0,0 +1,38 @@ +// +// URL+isImage.swift +// CodeEdit +// +// Created by Raymond Vleeshouwer on 14/05/23. +// + +import Foundation + +extension URL { + func isImage() -> Bool { + let ext: String = self.pathExtension.lowercased() + + // A list of supported file types by QLPreviewItem + // So...
CodeEdit/Utils/Extensions/URL/URL+isImage.swift
0
Swift
1
none
16
39
39
true
Quicklook Previews in Open Quickly overlay
1,266
CodeEditApp/CodeEdit
18,361
Swift
luah5
self.defaultTabWidth = try container.decodeIfPresent(Int.self, forKey: .defaultTabWidth) ?? 4 self.font = try container.decodeIfPresent(EditorFont.self, forKey: .font) ?? .init() self.enableTypeOverCompletion = try container.decodeIfPresent( Bool.self, ...
No issues found.
self.defaultTabWidth = try container.decodeIfPresent(Int.self, forKey: .defaultTabWidth) ?? 4 self.font = try container.decodeIfPresent(EditorFont.self, forKey: .font) ?? .init() self.enableTypeOverCompletion = try container.decodeIfPresent( Bool.self, ...
@@ -30,6 +30,10 @@ extension SettingsData { /// A multiplier for setting the line height. Defaults to `1.45` var lineHeightMultiple: Double = 1.45 + /// A multiplier for setting the letter spacing, `1` being no spacing and + /// `2` is one character of spacing between letters, defaults...
CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/TextEditingSettings.swift
0
Swift
1
none
16
51
51
true
Add setting for letter spacing
1,269
CodeEditApp/CodeEdit
18,361
Swift
luah5
// // SettingsColorPicker.swift // CodeEdit // // Created by Austin Condiff on 4/3/23. // import SwiftUI struct SettingsColorPicker: View { /// Color modified elsewhere in user theme @Binding var color: Color /// Component private color to display /// UI changes @State private var selectedCol...
No issues found.
// // SettingsColorPicker.swift // CodeEdit // // Created by Austin Condiff on 4/3/23. // import SwiftUI struct SettingsColorPicker: View { /// Color modified elsewhere in user theme @Binding var color: Color /// Component private color to display /// UI changes @State private var selectedCol...
@@ -8,19 +8,29 @@ import SwiftUI struct SettingsColorPicker: View { + + /// Color modified elsewhere in user theme @Binding var color: Color + /// Component private color to display + /// UI changes + @State private var selectedColor: Color + private let label: String init(_ label: St...
CodeEdit/Features/Settings/Views/SettingsColorPicker.swift
0
Swift
1
none
16
37
37
true
Fix Settings color picker
1,277
CodeEditApp/CodeEdit
18,361
Swift
defaultdino
if index == -1 { if !fileItem.isFolder { outlineView.setDropItem(fileItem.parent, dropChildIndex: index) } return info.draggingSourceOperationMask == .copy ? .copy : .move } return [] } /// handle successful or unsuccessful drop fu...
No issues found.
if index == -1 { if !fileItem.isFolder { outlineView.setDropItem(fileItem.parent, dropChildIndex: index) } return info.draggingSourceOperationMask == .copy ? .copy : .move } return [] } /// handle successful or unsuccessful drop fu...
@@ -89,8 +89,9 @@ final class ProjectNavigatorViewController: NSViewController { /// Updates the selection of the ``outlineView`` whenever it changes. /// /// Most importantly when the `id` changes from an external view. - func updateSelection() { - guard let itemID = workspace?.tabManager.acti...
CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift
0
Swift
1
none
16
51
51
true
Sync file selection state between tab group and outline view
1,296
CodeEditApp/CodeEdit
18,361
Swift
dscyrescotti
@Published var openQuicklyQuery: String = "" @Published var openQuicklyFiles: [CEWorkspaceFile] = [] @Published var isShowingOpenQuicklyFiles: Bool = false let fileURL: URL private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.searchFiles") init(fileURL: UR...
No issues found.
@Published var openQuicklyQuery: String = "" @Published var openQuicklyFiles: [CEWorkspaceFile] = [] @Published var isShowingOpenQuicklyFiles: Bool = false let fileURL: URL private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.searchFiles") init(fileURL: UR...
@@ -42,24 +42,28 @@ final class QuickOpenViewModel: ObservableObject { .isRegularFileKey ], options: [ - .skipsHiddenFiles, .skipsPackageDescendants ] ) if let filePaths = enumerator...
CodeEdit/Features/QuickOpen/ViewModels/QuickOpenViewModel.swift
0
Swift
1
none
16
51
51
true
Enhancement: #218 Fuzzy search for QuickOpen
1,307
CodeEditApp/CodeEdit
18,361
Swift
Wouter01
// // ProjectNavigatorViewController+NSMenuDelegate.swift // CodeEdit // // Created by Dscyre Scotti on 6/23/23. // import SwiftUI // MARK: - NSMenuDelegate extension ProjectNavigatorViewController: NSMenuDelegate { /// Once a menu gets requested by a `right click` setup the menu /// /// If the right ...
No issues found.
// // ProjectNavigatorViewController+NSMenuDelegate.swift // CodeEdit // // Created by Dscyre Scotti on 6/23/23. // import SwiftUI // MARK: - NSMenuDelegate extension ProjectNavigatorViewController: NSMenuDelegate { /// Once a menu gets requested by a `right click` setup the menu /// /// If the right ...
@@ -0,0 +1,33 @@ +// +// ProjectNavigatorViewController+NSMenuDelegate.swift +// CodeEdit +// +// Created by Dscyre Scotti on 6/23/23. +// + +import SwiftUI + +// MARK: - NSMenuDelegate +extension ProjectNavigatorViewController: NSMenuDelegate { + + /// Once a menu gets requested by a `right click` setup the menu...
CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController+NSMenuDelegate.swift
0
Swift
1
none
16
34
34
true
Reveal file in the middle of Project Navigator
1,352
CodeEditApp/CodeEdit
18,361
Swift
dscyrescotti
import WindowManagement @main struct CodeEditApp: App { /// The base URL of CodeEdit /// /// Points to `~/Library/Application Support/CodeEdit/` static var applicationSupportURL: URL { FileManager .default .homeDirectoryForCurrentUser .appendingPathComponent...
No issues found.
import WindowManagement @main struct CodeEditApp: App { /// The base URL of CodeEdit /// /// Points to `~/Library/Application Support/CodeEdit/` static var applicationSupportURL: URL { FileManager .default .homeDirectoryForCurrentUser .appendingPathComponent...
@@ -10,11 +10,22 @@ import WindowManagement @main struct CodeEditApp: App { - @NSApplicationDelegateAdaptor var appdelegate: AppDelegate + + /// The base URL of CodeEdit + /// + /// Points to `~/Library/Application Support/CodeEdit/` + static var applicationSupportURL: URL { + FileManager + ...
CodeEdit/CodeEditApp.swift
0
Swift
1
none
16
51
51
true
New files should not be saved to location until manually saved
1,366
CodeEditApp/CodeEdit
18,361
Swift
matthijseikelenboom
) .padding(.top, isActive && tabBarStyle == .native ? 1.22 : 0) // Tab content (icon and text). HStack(alignment: .center, spacing: 5) { Image(systemName: item.systemImage) .resizable() .aspectRatio(contentMo...
No issues found.
) .padding(.top, isActive && tabBarStyle == .native ? 1.22 : 0) // Tab content (icon and text). HStack(alignment: .center, spacing: 5) { Image(systemName: item.systemImage) .resizable() .aspectRatio(contentMo...
@@ -163,19 +163,6 @@ struct TabBarItemView: View { .padding(.horizontal, tabBarStyle == .native ? 28 : 23) .overlay { ZStack { - if isActive { - // Close Tab Shortcut: - // Using an invisible button to contain th...
CodeEdit/Features/Tabs/Views/TabBarItemView.swift
0
Swift
1
none
16
51
51
true
Fixed close tab and close window shortcut
1,381
CodeEditApp/CodeEdit
18,361
Swift
FastestMolasses
if !(terminalFontSize >= 288) { terminalFontSize += 1 } } .keyboardShortcut("+") .disabled(windowController == nil) Button("Decrease font size") { if !(editorFontSize <= 1) { editorFo...
No issues found.
if !(terminalFontSize >= 288) { terminalFontSize += 1 } } .keyboardShortcut("+") .disabled(windowController == nil) Button("Decrease font size") { if !(editorFontSize <= 1) { editorFo...
@@ -83,20 +83,19 @@ struct ViewCommands: Commands { } } .disabled(navigationSplitViewVisibility == nil) - .keyboardShortcut("s", modifiers: [.control, .command]) + .keyboardShortcut("0", modifiers: [.command]) Button...
CodeEdit/Features/WindowCommands/ViewCommands.swift
0
Swift
1
none
16
51
51
true
Keyboard shortcut to switch sidebar navigator tabs
1,382
CodeEditApp/CodeEdit
18,361
Swift
FastestMolasses
// // TabBarShadow.swift // CodeEdit // // Created by Austin Condiff on 8/22/23. // import SwiftUI struct TabBarShadow: View { var width: CGFloat var startPoint: UnitPoint var endPoint: UnitPoint @Environment(\.colorScheme) private var colorScheme @Environment(\.controlActiveState) pr...
No issues found.
// // TabBarShadow.swift // CodeEdit // // Created by Austin Condiff on 8/22/23. // import SwiftUI struct TabBarShadow: View { var width: CGFloat var startPoint: UnitPoint var endPoint: UnitPoint @Environment(\.colorScheme) private var colorScheme @Environment(\.controlActiveState) pr...
@@ -0,0 +1,46 @@ +// +// TabBarShadow.swift +// CodeEdit +// +// Created by Austin Condiff on 8/22/23. +// + +import SwiftUI + +struct TabBarShadow: View { + var width: CGFloat + var startPoint: UnitPoint + var endPoint: UnitPoint + + @Environment(\.colorScheme) + private var colorScheme + + @Envir...
CodeEdit/Features/Tabs/Views/TabBarShadow.swift
0
Swift
1
none
16
47
47
true
Added shadows to tab bar when tabs overflow
1,412
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
if let item = tabgroup.tabs.first(where: { $0.id == id }) { TabBarItemView( expectedWidth: expectedTabWidth, item: item, index: inde...
No issues found.
if let item = tabgroup.tabs.first(where: { $0.id == id }) { TabBarItemView( expectedWidth: expectedTabWidth, item: item, index: inde...
@@ -459,7 +459,7 @@ struct TabBarView: View { // MARK: Accessories private var leadingAccessories: some View { - HStack(spacing: 2) { + HStack(spacing: 0) { if let otherGroup = tabManager.tabGroups.findSomeTabGroup(except: tabgroup) { TabBarAccessoryIcon( ...
CodeEdit/Features/Tabs/Views/TabBarView.swift
0
Swift
1
none
16
51
51
true
Added ability to focus a single editor
1,414
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
Button { withAnimation(.linear(duration: 0)) { if visibility == .detailOnly { visibility = .all } else { visibility = .detailOnly ...
No issues found.
Button { withAnimation(.linear(duration: 0)) { if visibility == .detailOnly { visibility = .all } else { visibility = .detailOnly ...
@@ -13,28 +13,32 @@ struct WindowSplitView: View { @State var showInspector = true @State var window: NSWindow = .init() - var body: some View { - WindowObserver(window: window) { - NavigationSplitView(columnVisibility: $visibility) { - NavigatorAreaView(workspace: worksp...
CodeEdit/WindowSplitView.swift
0
Swift
1
none
16
51
51
true
Unsaved changes indicator in editor tab
1,441
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
release: nil, copyDescription: nil ) let contextPtr = withUnsafeMutablePointer(to: &context) { ptr in UnsafeMutablePointer(ptr) } let cfDirectory = directory as CFString let pathsToWatch = [cfDirectory] as CFArray if let ref = FSEventStreamCreate( ...
No issues found.
release: nil, copyDescription: nil ) let contextPtr = withUnsafeMutablePointer(to: &context) { ptr in UnsafeMutablePointer(ptr) } let cfDirectory = directory as CFString let pathsToWatch = [cfDirectory] as CFArray if let ref = FSEventStreamCreate( ...
@@ -41,9 +41,8 @@ class DirectoryEventStream { private let debounceDuration: TimeInterval struct Event { - let directory: String + let path: String let eventType: FSEvent - let deepRebuild: Bool } /// Initialize the event stream and begin listening for events. @@ -8...
CodeEdit/Features/CEWorkspace/Models/DirectoryEventStream.swift
0
Swift
1
none
16
51
51
true
Project navigator files watch fixes
1,452
CodeEditApp/CodeEdit
18,361
Swift
avinizhanov
return } fileManager.notifyObservers(updatedItems: updatedStatusFor) } /// Refresh current branch func refreshCurrentBranch() async { let currentBranch = try? await gitClient.getCurrentBranch() await MainActor.run { self.currentBranch = currentBranch...
No issues found.
return } fileManager.notifyObservers(updatedItems: updatedStatusFor) } /// Refresh current branch func refreshCurrentBranch() async { let currentBranch = try? await gitClient.getCurrentBranch() await MainActor.run { self.currentBranch = currentBranch...
@@ -152,6 +152,19 @@ final class SourceControlManager: ObservableObject { } } + /// Discard changes for repository + func discardAllChanges() { + Task { + do { + try await gitClient.discardAllChanges() + // TODO: Refresh content of active and unmodif...
CodeEdit/Features/Git/SourceControlManager.swift
0
Swift
1
none
16
51
51
true
feat: discard changes support for `SourceControlToolbarBottom`
1,480
CodeEditApp/CodeEdit
18,361
Swift
LeoBorai
// // AsyncFileIterator.swift // CodeEdit // // Created by Khan Winter on 12/4/23. // import Foundation /// Given a list of file URLs, asynchronously fetches their contents and returns them iteratively. /// Returns files as a ``SearchIndexer/AsyncManager/TextFile`` struct, used to index workspaces. struct AsyncFil...
No issues found.
// // AsyncFileIterator.swift // CodeEdit // // Created by Khan Winter on 12/4/23. // import Foundation /// Given a list of file URLs, asynchronously fetches their contents and returns them iteratively. /// Returns files as a ``SearchIndexer/AsyncManager/TextFile`` struct, used to index workspaces. struct AsyncFil...
@@ -0,0 +1,48 @@ +// +// AsyncFileIterator.swift +// CodeEdit +// +// Created by Khan Winter on 12/4/23. +// + +import Foundation + +/// Given a list of file URLs, asynchronously fetches their contents and returns them iteratively. +/// Returns files as a ``SearchIndexer/AsyncManager/TextFile`` struct, used to index...
CodeEdit/Features/Documents/Indexer/AsyncFileIterator.swift
0
Swift
1
none
16
49
49
true
Add Indexing Progress, Index Off Main Thread
1,501
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
} .opacity(activeState != .inactive ? 1 : 0.75) } private var chevron: some View { Image(systemName: "chevron.compact.right") .font(.system(size: 9, weight: activeState != .inactive ? .medium : .bold, design: .default)) .foregroundStyle(.secondary) .s...
No issues found.
} .opacity(activeState != .inactive ? 1 : 0.75) } private var chevron: some View { Image(systemName: "chevron.compact.right") .font(.system(size: 9, weight: activeState != .inactive ? .medium : .bold, design: .default)) .foregroundStyle(.secondary) .s...
@@ -0,0 +1,210 @@ +// +// FindModePicker.swift +// CodeEdit +// +// Created by Austin Condiff on 12/7/23. +// + +import SwiftUI +import Combine + +struct FindModePicker: View { + var modes: [SearchModeModel] + private let onSelect: (SearchModeModel) -> Void + @Binding var selection: SearchModeModel + + p...
CodeEdit/Features/NavigatorArea/FindNavigator/FindModePicker.swift
0
Swift
1
none
16
51
51
true
Updated path picker design
1,502
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
struct GlobPattern: Identifiable, Hashable, Decodable, Encodable { /// Ephimeral UUID used to track its representation in the UI var id = UUID() /// The Glob Pattern to render var value: String } /// The Search Settings View Model. Accessible via the singleton "``SearchSettings/shared``". /// /// **Us...
No issues found.
struct GlobPattern: Identifiable, Hashable, Decodable, Encodable { /// Ephimeral UUID used to track its representation in the UI var id = UUID() /// The Glob Pattern to render var value: String } /// The Search Settings View Model. Accessible via the singleton "``SearchSettings/shared``". /// /// **Us...
@@ -0,0 +1,67 @@ +// +// SearchSettingsModel.swift +// CodeEdit +// +// Created by Esteban on 12/10/23. +// + +import SwiftUI + +struct GlobPattern: Identifiable, Hashable, Decodable, Encodable { + /// Ephimeral UUID used to track its representation in the UI + var id = UUID() + + /// The Glob Pattern to re...
CodeEdit/Features/Settings/Pages/SearchSettings/Models/SearchSettingsModel.swift
0
Swift
1
none
16
51
51
true
feat(settings): section with glob pattern crud
1,507
CodeEditApp/CodeEdit
18,361
Swift
LeoBorai
} @State private var selectedTheme = ThemeModel.shared.selectedTheme ?? ThemeModel.shared.themes.first! @State private var font: NSFont = { return Settings[\.textEditing].font.current() }() @State private var bracketPairHighlight: BracketPairHighlight? = { let theme = ThemeModel.s...
No issues found.
} @State private var selectedTheme = ThemeModel.shared.selectedTheme ?? ThemeModel.shared.themes.first! @State private var font: NSFont = { return Settings[\.textEditing].font.current() }() @State private var bracketPairHighlight: BracketPairHighlight? = { let theme = ThemeModel.s...
@@ -7,6 +7,7 @@ import Foundation import SwiftUI +import CodeEditSourceEditor import CodeEditTextView import CodeEditLanguages import Combine @@ -98,7 +99,7 @@ struct CodeFileView: View { @EnvironmentObject private var editor: Editor var body: some View { - CodeEditTextView( + CodeEditS...
CodeEdit/Features/CodeFile/CodeFileView.swift
0
Swift
1
none
16
51
51
true
Update To New Text View
1,509
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
if let index = self.index { return modifyIndexQueue.sync { SKIndexRemoveDocument(index, document) } } return false } /// Returns the number of terms of the specified document private func termCount(for document: SKDocumentID) -> Int { ...
No issues found.
if let index = self.index { return modifyIndexQueue.sync { SKIndexRemoveDocument(index, document) } } return false } /// Returns the number of terms of the specified document private func termCount(for document: SKDocumentID) -> Int { ...
@@ -9,10 +9,10 @@ import Foundation import UniformTypeIdentifiers extension SearchIndexer { - /// A "typealias" for a document ID, using a struct becasue swift lint doesn't allow typealiases for 3 types + /// A "typealias" for a document ID, using a struct because swift lint doesn't allow type-aliases for 3 t...
CodeEdit/Features/Documents/Indexer/SearchIndexer+InternalMethods.swift
0
Swift
1
none
16
51
51
true
Fixing Typos
1,579
CodeEditApp/CodeEdit
18,361
Swift
tom-ludwig
.keyboardShortcut("n") Button("Open...") { NSDocumentController.shared.openDocument(nil) } .keyboardShortcut("o") // Leave this empty, is done through a hidden API in WindowCommands/Utils/CommandsFixes.swift ...
No issues found.
.keyboardShortcut("n") Button("Open...") { NSDocumentController.shared.openDocument(nil) } .keyboardShortcut("o") // Leave this empty, is done through a hidden API in WindowCommands/Utils/CommandsFixes.swift ...
@@ -37,12 +37,24 @@ struct FileCommands: Commands { CommandGroup(replacing: .saveItem) { Button("Close Tab") { - NSApp.sendAction(#selector(CodeEditWindowController.closeCurrentTab(_:)), to: nil, from: nil) + if NSApp.target(forAction: #selector(CodeEditWindowContro...
CodeEdit/Features/WindowCommands/FileCommands.swift
0
Swift
1
none
16
51
51
true
Correct Commands For All Windows, Fix ⌘W
1,587
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
// // NavigationSettings.swift // CodeEdit // // Created by Austin Condiff on 3/4/24. // import Foundation extension SettingsData { /// The global settings for the terminal emulator struct NavigationSettings: Codable, Hashable, SearchableSettingsPage { /// The search keys var searchKeys: ...
No issues found.
// // NavigationSettings.swift // CodeEdit // // Created by Austin Condiff on 3/4/24. // import Foundation extension SettingsData { /// The global settings for the terminal emulator struct NavigationSettings: Codable, Hashable, SearchableSettingsPage { /// The search keys var searchKeys: ...
@@ -0,0 +1,42 @@ +// +// NavigationSettings.swift +// CodeEdit +// +// Created by Austin Condiff on 3/4/24. +// + +import Foundation + +extension SettingsData { + + /// The global settings for the terminal emulator + struct NavigationSettings: Codable, Hashable, SearchableSettingsPage { + + /// The sear...
CodeEdit/Features/Settings/Pages/NavigationSettings/Models/NavigationSettings.swift
0
Swift
1
none
16
43
43
true
Navigation style setting and file history navigation improvements
1,603
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
/// Configure shell integration script private func setupShellIntegration(shell: String, environment: [String]) { // Get user's home dir var homePath: String = "" environment.forEach { value in if value.starts(with: "HOME=") { homePath = value } ...
No issues found.
/// Configure shell integration script private func setupShellIntegration(shell: String, environment: [String]) { // Get user's home dir var homePath: String = "" environment.forEach { value in if value.starts(with: "HOME=") { homePath = value } ...
@@ -27,26 +27,12 @@ struct TerminalEmulatorView: NSViewRepresentable { @State var terminal: LocalProcessTerminalView - private let systemFont: NSFont = .monospacedSystemFont(ofSize: 11, weight: .medium) - private var font: NSFont { if terminalSettings.useTextEditorFont { - if !fontS...
CodeEdit/Features/TerminalEmulator/TerminalEmulatorView.swift
0
Swift
1
none
16
51
51
true
Font Improvement
1,608
CodeEditApp/CodeEdit
18,361
Swift
ibrahimcetin
// // WindowCommands.swift // CodeEdit // // Created by Wouter Hennen on 13/03/2023. // import SwiftUI struct WindowCommands: Commands { @Environment(\.openWindow) var openWindow var body: some Commands { CommandGroup(replacing: .singleWindowList) { Button("Welcome to CodeEdit") { ...
No issues found.
// // WindowCommands.swift // CodeEdit // // Created by Wouter Hennen on 13/03/2023. // import SwiftUI struct WindowCommands: Commands { @Environment(\.openWindow) var openWindow var body: some Commands { CommandGroup(replacing: .singleWindowList) { Button("Welcome to CodeEdit") { ...
@@ -8,47 +8,25 @@ import SwiftUI struct WindowCommands: Commands { - @Environment(\.openWindow) var openWindow var body: some Commands { CommandGroup(replacing: .singleWindowList) { Button("Welcome to CodeEdit") { - NSApp.openWindow(.welcome) + op...
CodeEdit/Features/WindowCommands/WindowCommands.swift
0
Swift
1
none
16
33
33
true
Fix: Window Actions
1,627
CodeEditApp/CodeEdit
18,361
Swift
ibrahimcetin
} } private var inactiveColor: Color { Color(nsColor: .disabledControlTextColor) } private var title: String { workspaceFileManager?.folderUrl.lastPathComponent ?? "Empty" } // MARK: Popover View /// A popover view that appears once the branch picker is tapped. ...
No issues found.
} } private var inactiveColor: Color { Color(nsColor: .disabledControlTextColor) } private var title: String { workspaceFileManager?.folderUrl.lastPathComponent ?? "Empty" } // MARK: Popover View /// A popover view that appears once the branch picker is tapped. ...
@@ -112,15 +112,15 @@ struct ToolbarBranchPicker: View { } } - let branches = sourceControlManager.branches - .filter({ $0.isLocal && $0 != sourceControlManager.currentBranch }) + let branches = sourceControlManager.orderedLocalBra...
CodeEdit/Features/CodeEditUI/Views/ToolbarBranchPicker.swift
0
Swift
1
none
16
51
51
true
Git branches list order and truncate priority issue
1,647
CodeEditApp/CodeEdit
18,361
Swift
phlpsong
// // CommandPaletteViewModel.swift // CodeEdit // // Created by Alex on 25.05.2022. // import Foundation /// Simple state class for command palette view. Contains currently selected command, /// query text and list of filtered commands final class QuickActionsViewModel: ObservableObject { @Published var comm...
No issues found.
// // CommandPaletteViewModel.swift // CodeEdit // // Created by Alex on 25.05.2022. // import Foundation /// Simple state class for command palette view. Contains currently selected command, /// query text and list of filtered commands final class QuickActionsViewModel: ObservableObject { @Published var comm...
@@ -9,7 +9,7 @@ import Foundation /// Simple state class for command palette view. Contains currently selected command, /// query text and list of filtered commands -final class CommandPaletteViewModel: ObservableObject { +final class QuickActionsViewModel: ObservableObject { @Published var commandQuery: Str...
CodeEdit/Features/Commands/ViewModels/QuickActionsViewModel.swift
0
Swift
1
none
16
40
40
true
Rename CommandPalleteView and CommandPalleteViewModel classes
1,655
CodeEditApp/CodeEdit
18,361
Swift
dklaver15
/// A service container that manages the registration and resolution of services. enum ServiceContainer { /// A dictionary storing the closures for creating service instances. private static var factories: [ObjectIdentifier: () -> Any] = [:] /// A dictionary storing the cached service instances. privat...
No issues found.
/// A service container that manages the registration and resolution of services. enum ServiceContainer { /// A dictionary storing the closures for creating service instances. private static var factories: [ObjectIdentifier: () -> Any] = [:] /// A dictionary storing the cached service instances. privat...
@@ -0,0 +1,65 @@ +// +// ServiceContainer.swift +// CodeEdit +// +// Created by Abe Malla on 4/3/24. +// + +import Foundation + +/// A service container that manages the registration and resolution of services. +enum ServiceContainer { + /// A dictionary storing the closures for creating service instances. + p...
CodeEdit/Utils/DependencyInjection/ServiceContainer.swift
0
Swift
1
none
16
51
51
true
Added dependency injection
1,662
CodeEditApp/CodeEdit
18,361
Swift
FastestMolasses
} var primaryItems = [NSMenuItem]() if type.conforms(to: .sourceCode) { primaryItems.append(.sourceCode()) } if type.conforms(to: .propertyList) { primaryItems.append(.propertyList()) } if type.conforms(t...
No issues found.
} var primaryItems = [NSMenuItem]() if type.conforms(to: .sourceCode) { primaryItems.append(.sourceCode()) } if type.conforms(to: .propertyList) { primaryItems.append(.propertyList()) } if type.conforms(t...
@@ -59,9 +59,17 @@ final class ProjectNavigatorMenu: NSMenu { let newFolder = menuItem("New Folder", action: #selector(newFolder)) let rename = menuItem("Rename", action: #selector(renameFile)) - let delete = menuItem("Delete", action: + + let trash = menuItem("Move to Trash", action: ...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenu.swift
0
Swift
1
none
16
51
51
true
fix: distinguish between Move to Trash and Delete Immediately when right clicking a file or folder.
1,694
CodeEditApp/CodeEdit
18,361
Swift
plbstl
] } func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { [ .toggleFirstSidebarItem, .sidebarTrackingSeparator, .flexibleSpace, .itemListTrackingSeparator, .toggleLastSidebarItem, .branchP...
No issues found.
] } func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { [ .toggleFirstSidebarItem, .sidebarTrackingSeparator, .flexibleSpace, .itemListTrackingSeparator, .toggleLastSidebarItem, .branchP...
@@ -0,0 +1,127 @@ +// +// CodeEditWindowController+Toolbar.swift +// CodeEdit +// +// Created by Daniel Zhu on 5/10/24. +// + +import AppKit +import SwiftUI + +extension CodeEditWindowController { + internal func setupToolbar() { + let toolbar = NSToolbar(identifier: UUID().uuidString) + toolbar.del...
CodeEdit/Features/Documents/Controllers/CodeEditWindowController+Toolbar.swift
0
Swift
1
none
16
51
51
true
Fixes "Menu Bar Items Not Updating (#1684)"
1,697
CodeEditApp/CodeEdit
18,361
Swift
xyzqm
var utType: UTType? { if content != nil { return .text } guard let fileType, let type = UTType(fileType) else { return nil } if type.conforms(to: .text) { return .text } if type.conforms(to: .image) { return .ima...
No issues found.
var utType: UTType? { if content != nil { return .text } guard let fileType, let type = UTType(fileType) else { return nil } if type.conforms(to: .text) { return .text } if type.conforms(to: .image) { return .ima...
@@ -65,7 +65,7 @@ final class CodeFileDocument: NSDocument, ObservableObject { /// - Note: The UTType doesn't necessarily mean the file extension, it can be the MIME /// type or any other form of data representation. var utType: UTType? { - if content != nil && content?.isEmpty ?? true { + ...
CodeEdit/Features/Documents/CodeFileDocument.swift
0
Swift
1
none
16
51
51
true
Allow text files to be edited even when empty
1,724
CodeEditApp/CodeEdit
18,361
Swift
plbstl
// // DeveloperSettings.swift // CodeEdit // // Created by Abe Malla on 5/15/24. // import Foundation extension SettingsData { struct DeveloperSettings: Codable, Hashable, SearchableSettingsPage { /// The search keys var searchKeys: [String] { [ "Developer", ...
No issues found.
// // DeveloperSettings.swift // CodeEdit // // Created by Abe Malla on 5/15/24. // import Foundation extension SettingsData { struct DeveloperSettings: Codable, Hashable, SearchableSettingsPage { /// The search keys var searchKeys: [String] { [ "Developer", ...
@@ -0,0 +1,39 @@ +// +// DeveloperSettings.swift +// CodeEdit +// +// Created by Abe Malla on 5/15/24. +// + +import Foundation + +extension SettingsData { + struct DeveloperSettings: Codable, Hashable, SearchableSettingsPage { + + /// The search keys + var searchKeys: [String] { + [ + ...
CodeEdit/Features/Settings/Pages/DeveloperSettings/Models/DeveloperSettings.swift
0
Swift
1
none
16
40
40
true
Developer settings menu
1,733
CodeEditApp/CodeEdit
18,361
Swift
FastestMolasses
case .failedToDecodeURL: "Failed to decode URL" case .noRemoteConfigured: "No remote configured" } } } internal let directoryURL: URL internal let shellClient: ShellClient init(directoryURL: URL, shellClient: ShellClient) { self.directoryURL = direct...
No issues found.
case .failedToDecodeURL: "Failed to decode URL" case .noRemoteConfigured: "No remote configured" } } } internal let directoryURL: URL internal let shellClient: ShellClient init(directoryURL: URL, shellClient: ShellClient) { self.directoryURL = direct...
@@ -13,12 +13,14 @@ class GitClient { case outputError(String) case notGitRepository case failedToDecodeURL + case noRemoteConfigured var description: String { switch self { case .outputError(let string): string case .notGitRepository: ...
CodeEdit/Features/Git/Client/GitClient.swift
0
Swift
1
none
16
51
51
true
Show Git history in the History Inspector, even when a remote is not configured
1,744
CodeEditApp/CodeEdit
18,361
Swift
simonwhitaker
// Created by Austin Condiff on 6/17/24. // import SwiftUI extension NSFont { /// Rough mapping from behavior of .systemFont(…weight:) /// to NSFontManager's Int-based weight, as of 13.4 Ventura func withWeight(weight: NSFont.Weight) -> NSFont? { let fontManager = NSFontManager.shared var...
No issues found.
// Created by Austin Condiff on 6/17/24. // import SwiftUI extension NSFont { /// Rough mapping from behavior of .systemFont(…weight:) /// to NSFontManager's Int-based weight, as of 13.4 Ventura func withWeight(weight: NSFont.Weight) -> NSFont? { let fontManager = NSFontManager.shared var...
@@ -0,0 +1,58 @@ +// +// NSFont+WithWeight.swift +// CodeEdit +// +// Created by Austin Condiff on 6/17/24. +// + +import SwiftUI + +extension NSFont { + /// Rough mapping from behavior of .systemFont(…weight:) + /// to NSFontManager's Int-based weight, as of 13.4 Ventura + func withWeight(weight: NSFont.We...
CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/NSFont+WithWeight.swift
0
Swift
1
none
16
51
51
true
Added font weight pickers to text editing and terminal settings
1,758
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
/// This is used to populate the ``OpenQuicklyListItemView`` view which shows the search results to the user. /// /// ``OpenQuicklyPreviewView`` also uses this to load the `fileUrl` for preview. struct SearchResult: Identifiable, Hashable { var id: String { fileURL.id } let fileURL: URL...
No issues found.
/// This is used to populate the ``OpenQuicklyListItemView`` view which shows the search results to the user. /// /// ``OpenQuicklyPreviewView`` also uses this to load the `fileUrl` for preview. struct SearchResult: Identifiable, Hashable { var id: String { fileURL.id } let fileURL: URL...
@@ -0,0 +1,91 @@ +// +// OpenQuicklyViewModel.swift +// CodeEditModules/QuickOpen +// +// Created by Marco Carnevali on 05/04/22. +// + +import Combine +import Foundation +import CollectionConcurrencyKit + +final class OpenQuicklyViewModel: ObservableObject { + @Published var query: String = "" + @Published va...
CodeEdit/Features/OpenQuickly/ViewModels/OpenQuicklyViewModel.swift
0
Swift
1
none
16
51
51
true
highlight search query in 'Open Quickly' results
1,790
CodeEditApp/CodeEdit
18,361
Swift
plbstl
// // Collection+subscript_safe.swift // CodeEdit // // Created by Paul Ebose on 2024/07/05. // import Foundation extension Collection { /// Returns the element at the specified index if it is within bounds, otherwise nil. subscript (safe index: Index) -> Element? { indices.contains(index) ? self[i...
No issues found.
// // Collection+subscript_safe.swift // CodeEdit // // Created by Paul Ebose on 2024/07/05. // import Foundation extension Collection { /// Returns the element at the specified index if it is within bounds, otherwise nil. subscript (safe index: Index) -> Element? { indices.contains(index) ? self[i...
@@ -0,0 +1,15 @@ +// +// Collection+subscript_safe.swift +// CodeEdit +// +// Created by Paul Ebose on 2024/07/05. +// + +import Foundation + +extension Collection { + /// Returns the element at the specified index if it is within bounds, otherwise nil. + subscript (safe index: Index) -> Element? { + in...
CodeEdit/Utils/Extensions/Collection/Collection+subscript_safe.swift
0
Swift
1
none
16
16
16
true
fix 'Open Quickly' fatal error
1,793
CodeEditApp/CodeEdit
18,361
Swift
plbstl
Group { Menu { ForEach( Array(editor.history.dropFirst(editor.historyOffset+1).enumerated()), id: \.offset ) { index, tab in Button { editorManager.activeEditor = editor ...
No issues found.
Group { Menu { ForEach( Array(editor.history.dropFirst(editor.historyOffset+1).enumerated()), id: \.offset ) { index, tab in Button { editorManager.activeEditor = editor ...
@@ -0,0 +1,78 @@ +// +// EditorHistoryMenus.swift +// CodeEdit +// +// Created by Khan Winter on 7/8/24. +// + +import SwiftUI + +struct EditorHistoryMenus: View { + @EnvironmentObject private var editorManager: EditorManager + @EnvironmentObject private var editor: Editor + + var body: some View { + ...
CodeEdit/Features/Editor/TabBar/Views/EditorHistoryMenus.swift
0
Swift
1
none
16
51
51
true
Fix Navigator Key Navigation Explosion
1,803
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
// // AnyFileView.swift // CodeEdit // // Created by Paul Ebose on 2024/5/9. // import SwiftUI import QuickLookUI /// A view for previewing any kind of file. /// /// ```swift /// AnyFileView(fileURL) /// ``` /// If the file cannot be previewed, a file icon thumbnail is shown instead. struct AnyFileView: NSViewRepr...
No issues found.
// // AnyFileView.swift // CodeEdit // // Created by Paul Ebose on 2024/5/9. // import SwiftUI import QuickLookUI /// A view for previewing any kind of file. /// /// ```swift /// AnyFileView(fileURL) /// ``` /// If the file cannot be previewed, a file icon thumbnail is shown instead. struct AnyFileView: NSViewRepr...
@@ -17,20 +17,27 @@ import QuickLookUI struct AnyFileView: NSViewRepresentable { /// URL of the file to preview. You can pass in any file type. - private let fileURL: URL + private let fileURL: NSURL init(_ fileURL: URL) { - self.fileURL = fileURL + self.fileURL = fileURL as NSURL ...
CodeEdit/Features/Editor/Views/AnyFileView.swift
0
Swift
1
none
16
44
44
true
Correctly view non-text files in single file window and Open Quickly
1,820
CodeEditApp/CodeEdit
18,361
Swift
plbstl
// SearchField.swift // CodeEdit // // Created by Austin Condiff on 9/3/24. // import SwiftUI struct SearchField: NSViewRepresentable { @Binding var text: String var placeholder: String init(_ placeholder: String, text: Binding<String>) { self.placeholder = placeholder self._text = tex...
No issues found.
// SearchField.swift // CodeEdit // // Created by Austin Condiff on 9/3/24. // import SwiftUI struct SearchField: NSViewRepresentable { @Binding var text: String var placeholder: String init(_ placeholder: String, text: Binding<String>) { self.placeholder = placeholder self._text = tex...
@@ -0,0 +1,51 @@ +// +// SearchField.swift +// CodeEdit +// +// Created by Austin Condiff on 9/3/24. +// + +import SwiftUI + +struct SearchField: NSViewRepresentable { + @Binding var text: String + var placeholder: String + + init(_ placeholder: String, text: Binding<String>) { + self.placeholder = p...
CodeEdit/Features/CodeEditUI/Views/SearchField.swift
0
Swift
1
none
16
51
51
true
feat(themes): Add fuzzy search for filtering and sorting themes in settings
1,849
CodeEditApp/CodeEdit
18,361
Swift
tom-ludwig
// // OutlintViewController+OutlineTableViewCellDelegate.swift // CodeEdit // // Created by Ziyuan Zhao on 2023/2/5. // import Foundation // MARK: - OutlineTableViewCellDelegate extension ProjectNavigatorViewController: OutlineTableViewCellDelegate { func moveFile(file: CEWorkspaceFile, to destination: URL) {...
No issues found.
// // OutlintViewController+OutlineTableViewCellDelegate.swift // CodeEdit // // Created by Ziyuan Zhao on 2023/2/5. // import Foundation // MARK: - OutlineTableViewCellDelegate extension ProjectNavigatorViewController: OutlineTableViewCellDelegate { func moveFile(file: CEWorkspaceFile, to destination: URL) {...
@@ -15,8 +15,22 @@ extension ProjectNavigatorViewController: OutlineTableViewCellDelegate { workspace?.editorManager?.editorLayout.closeAllTabs(of: file) } workspace?.workspaceFileManager?.move(file: file, to: destination) - if !file.isFolder { - workspace?.editorManager...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController+OutlineTableViewCellDelegate.swift
0
Swift
1
none
16
41
41
true
Rebuild Cached Files After Rename, Git Status Label
1,866
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
/// Searches through an array of pages to check if a page name exists in the array private func resultFound(_ page: SettingsPage, pages: [SettingsPage]) -> SettingsSearchResult { let lowercasedSearchText = searchText.lowercased() var returnedPages: [SettingsPage] = [] var foundPage = fa...
No issues found.
/// Searches through an array of pages to check if a page name exists in the array private func resultFound(_ page: SettingsPage, pages: [SettingsPage]) -> SettingsSearchResult { let lowercasedSearchText = searchText.lowercased() var returnedPages: [SettingsPage] = [] var foundPage = fa...
@@ -144,14 +144,17 @@ struct SettingsView: View { var body: some View { NavigationSplitView { + List { } + .searchable(text: $searchText, placement: .sidebar, prompt: "Search") + .scrollDisabled(true) + .frame(height: 30) List(selectio...
CodeEdit/Features/Settings/SettingsView.swift
0
Swift
1
none
16
51
51
true
Closing tabs while Open Quickly or Command Palette is open is no longer allowed.
1,868
CodeEditApp/CodeEdit
18,361
Swift
scaredcr6w
for binary in lspBinaries { if let language = LanguageIdentifier(rawValue: binary.key) { self.languageConfigs[language] = LanguageServerBinary( execPath: binary.value, args: [], env: ProcessInfo.processInfo.environment ...
No issues found.
for binary in lspBinaries { if let language = LanguageIdentifier(rawValue: binary.key) { self.languageConfigs[language] = LanguageServerBinary( execPath: binary.value, args: [], env: ProcessInfo.processInfo.environment ...
@@ -269,10 +269,24 @@ final class LSPService: ObservableObject { } /// Goes through all active language servers and attempts to shut them down. - func stopAllServers() async throws { - for key in languageClients.keys { - try await stopServer(forLanguage: key.languageId, workspacePath: k...
CodeEdit/Features/LSP/Service/LSPService.swift
0
Swift
1
none
16
51
51
true
Clean Up Child Processes
1,885
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
} .padding(.horizontal, 10) .padding(.vertical, 5) Divider() if findNavigatorStatus == .found { HStack(alignment: .center) { Text("\(self.searchResultCount) results in \(self.foundFilesCount) files") ...
No issues found.
} .padding(.horizontal, 10) .padding(.vertical, 5) Divider() if findNavigatorStatus == .found { HStack(alignment: .center) { Text("\(self.searchResultCount) results in \(self.foundFilesCount) files") ...
@@ -89,10 +89,12 @@ struct FindNavigatorView: View { .safeAreaInset(edge: .bottom, spacing: 0) { FindNavigatorToolbarBottom() } - .onReceive(state.objectWillChange) { _ in - self.searchResultCount = state.searchResultsCount - self.foundFilesCount = state.searc...
CodeEdit/Features/NavigatorArea/FindNavigator/FindNavigatorView.swift
0
Swift
1
none
16
51
51
true
Fix search text disappearance on changing navigation item
1,889
CodeEditApp/CodeEdit
18,361
Swift
karan0046
/// - Parameter tab: The tab to add to the history. func addToHistory(_ tab: Tab) { if history.first != tab.file { history.prepend(tab.file) } } /// Clear any tabs in the "future" on the history list. Resets the history offset and removes any tabs that were /// available...
No issues found.
/// - Parameter tab: The tab to add to the history. func addToHistory(_ tab: Tab) { if history.first != tab.file { history.prepend(tab.file) } } /// Clear any tabs in the "future" on the history list. Resets the history offset and removes any tabs that were /// available...
@@ -12,8 +12,8 @@ extension Editor { /// Add the tab to the history list. /// - Parameter tab: The tab to add to the history. func addToHistory(_ tab: Tab) { - if history.first != tab { - history.prepend(tab) + if history.first != tab.file { + history.prepend(tab.file)...
CodeEdit/Features/Editor/Models/Editor+History.swift
0
Swift
1
none
16
51
51
true
EditorManager Always Opens Files
1,892
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
} return false } /// Write dragged file(s) to pasteboard func outlineView(_ outlineView: NSOutlineView, pasteboardWriterForItem item: Any) -> NSPasteboardWriting? { guard let fileItem = item as? CEWorkspaceFile else { return nil } return fileItem.url as NSURL } /// ...
No issues found.
} return false } /// Write dragged file(s) to pasteboard func outlineView(_ outlineView: NSOutlineView, pasteboardWriterForItem item: Any) -> NSPasteboardWriting? { guard let fileItem = item as? CEWorkspaceFile else { return nil } return fileItem.url as NSURL } /// ...
@@ -8,17 +8,31 @@ import AppKit extension ProjectNavigatorViewController: NSOutlineViewDataSource { + /// Retrieves the children of a given item for the outline view, applying the current filter if necessary. + private func getOutlineViewItems(for item: CEWorkspaceFile) -> [CEWorkspaceFile] { + if let ...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController+NSOutlineViewDataSource.swift
0
Swift
1
none
16
51
51
true
Project navigator file filtering
1,896
CodeEditApp/CodeEdit
18,361
Swift
LeonardoLarranaga
openInNewWindow, openExternalEditor, openAs, NSMenuItem.separator(), showFileInspector, NSMenuItem.separator(), newFile, newFolder ] if canCreateFolderFromSelection() { items.append(menuItem("New...
No issues found.
openInNewWindow, openExternalEditor, openAs, NSMenuItem.separator(), showFileInspector, NSMenuItem.separator(), newFile, newFolder ] if canCreateFolderFromSelection() { items.append(menuItem("New...
@@ -17,10 +17,12 @@ final class ProjectNavigatorMenu: NSMenu { /// The workspace, for opening the item var workspace: WorkspaceDocument? - var outlineView: NSOutlineView + /// The `ProjectNavigatorViewController` is being called from. + /// By sending it, we can access it's variables and functions...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenu.swift
0
Swift
1
none
16
51
51
true
Select multiple files in the project navigator
1,906
CodeEditApp/CodeEdit
18,361
Swift
LeonardoLarranaga
/// Specify options for opening the file such as the initial cursor positions. /// Nulled by ``CodeFileView`` on first load. var openOptions: OpenOptions? private let isDocumentEditedSubject = PassthroughSubject<Bool, Never>() /// Publisher for isDocumentEdited property var isDocumentEditedPub...
No issues found.
/// Specify options for opening the file such as the initial cursor positions. /// Nulled by ``CodeFileView`` on first load. var openOptions: OpenOptions? private let isDocumentEditedSubject = PassthroughSubject<Bool, Never>() /// Publisher for isDocumentEdited property var isDocumentEditedPub...
@@ -191,6 +191,23 @@ final class CodeFileDocument: NSDocument, ObservableObject { NotificationCenter.default.post(name: Self.didCloseNotification, object: fileURL) } + override func save(_ sender: Any?) { + guard let fileURL else { + super.save(sender) + return + }...
CodeEdit/Features/Documents/CodeFileDocument/CodeFileDocument.swift
0
Swift
1
none
16
51
51
true
Add indication for externally deleted files
1,999
CodeEditApp/CodeEdit
18,361
Swift
pro100filipp
} } catch { let alert = NSAlert(error: error) alert.addButton(withTitle: "Dismiss") alert.runModal() } } /// Creates a new folder with the items selected. @objc func newFolderFromSelection() { guard let workspace, let workspaceFile...
No issues found.
} } catch { let alert = NSAlert(error: error) alert.addButton(withTitle: "Dismiss") alert.runModal() } } /// Creates a new folder with the items selected. @objc func newFolderFromSelection() { guard let workspace, let workspaceFile...
@@ -222,6 +222,42 @@ extension ProjectNavigatorMenu { } } + /// Copies the absolute path of the selected files + @objc + func copyPath() { + let paths = selectedItems().map { + $0.url.standardizedFileURL.path + }.sorted().joined(separator: "\n") + NSPasteboard.ge...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenuActions.swift
0
Swift
1
none
16
51
51
true
Added copy path and copy relative path options in project navigator menu
2,013
CodeEditApp/CodeEdit
18,361
Swift
FastestMolasses
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { if let item = item as? CEWorkspaceFile { return item.isFolder } return false } /// Write dragged file(s) to pasteboard func outlineView(_ outlineView: NSOutlineView, pasteboardWrite...
No issues found.
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { if let item = item as? CEWorkspaceFile { return item.isFolder } return false } /// Write dragged file(s) to pasteboard func outlineView(_ outlineView: NSOutlineView, pasteboardWrite...
@@ -15,8 +15,11 @@ extension ProjectNavigatorViewController: NSOutlineViewDataSource { } if let children = workspace?.workspaceFileManager?.childrenOfFile(item) { - if let filter = workspace?.navigatorFilter, !filter.isEmpty { - let filteredChildren = children.filter { file...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController+NSOutlineViewDataSource.swift
0
Swift
1
none
16
51
51
true
Source Control Filter
2,024
CodeEditApp/CodeEdit
18,361
Swift
LeonardoLarranaga
if let item = item as? CEWorkspaceFile { return getOutlineViewItems(for: item)[index] } return content[index] } func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { if let item = item as? CEWorkspaceFile { return item.isFol...
No issues found.
if let item = item as? CEWorkspaceFile { return getOutlineViewItems(for: item)[index] } return content[index] } func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { if let item = item as? CEWorkspaceFile { return item.isFol...
@@ -12,19 +12,29 @@ extension ProjectNavigatorViewController: NSOutlineViewDataSource { private func getOutlineViewItems(for item: CEWorkspaceFile) -> [CEWorkspaceFile] { if let cachedChildren = filteredContentChildren[item] { return cachedChildren + .sorted { lhs, rhs in + ...
CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController+NSOutlineViewDataSource.swift
0
Swift
1
none
16
51
51
true
Sort alphabetically - Folders on top
2,028
CodeEditApp/CodeEdit
18,361
Swift
LeonardoLarranaga
clearMenuItem.target = self menu.addItem(clearMenuItem) return menu } private func addFileURLs(to menu: NSMenu, fileURLs: ArraySlice<URL>) { for url in fileURLs { let icon = NSWorkspace.shared.icon(forFile: url.path(percentEncoded: false)) icon.size = NS...
No issues found.
clearMenuItem.target = self menu.addItem(clearMenuItem) return menu } private func addFileURLs(to menu: NSMenu, fileURLs: ArraySlice<URL>) { for url in fileURLs { let icon = NSWorkspace.shared.icon(forFile: url.path(percentEncoded: false)) icon.size = NS...
@@ -8,27 +8,48 @@ import AppKit class RecentProjectsMenu: NSObject { + let projectsStore: RecentProjectsStore + + init(projectsStore: RecentProjectsStore = .shared) { + self.projectsStore = projectsStore + } + func makeMenu() -> NSMenu { let menu = NSMenu(title: NSLocalizedString("Open...
CodeEdit/Features/WindowCommands/Utils/RecentProjectsMenu.swift
0
Swift
1
none
16
51
51
true
Separated files and folders in the "Open Recent" sub-menu
2,039
CodeEditApp/CodeEdit
18,361
Swift
atsrus
// CodeEdit // // Created by Khan Winter on 10/22/24. // import Foundation extension URL { /// Compare a URL using its path components. /// - Parameter other: The URL to compare to /// - Returns: `true` if the URL points to the same path on disk. Regardless of query parameters, trailing /// ...
No issues found.
// CodeEdit // // Created by Khan Winter on 10/22/24. // import Foundation extension URL { /// Compare a URL using its path components. /// - Parameter other: The URL to compare to /// - Returns: `true` if the URL points to the same path on disk. Regardless of query parameters, trailing /// ...
@@ -15,4 +15,39 @@ extension URL { func componentCompare(_ other: URL) -> Bool { return self.pathComponents == other.pathComponents } + + /// Determines if another URL is lower in the file system than this URL. + /// + /// Examples: + /// ``` + /// URL(filePath: "/Users/Bob/Desktop").c...
CodeEdit/Utils/Extensions/URL/URL+componentCompare.swift
0
Swift
1
none
16
51
51
true
Open New Files in Workspace
2,043
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
} /// Test 3: Show interface shows all panels when none are visible. func testShowInterfaceShowsAllWhenNoneVisible() { let viewMenu = app.menuBars.menuBarItems["View"] // Ensure all panels are hidden for panel in allPanels() { let hideItem = "Hide \(panel)" i...
No issues found.
} /// Test 3: Show interface shows all panels when none are visible. func testShowInterfaceShowsAllWhenNoneVisible() { let viewMenu = app.menuBars.menuBarItems["View"] // Ensure all panels are hidden for panel in allPanels() { let hideItem = "Hide \(panel)" i...
@@ -0,0 +1,184 @@ +// +// HiderInterfaceTests.swift +// CodeEditUITests +// +// Created by Simon Kudsk on 14/05/2025. +// + +import XCTest +final class HideInterfaceUITests: XCTestCase { + + // MARK: – Setup + private var app: XCUIApplication! + private var path: String! + + override func setUp() async t...
CodeEditUITests/Other Tests/HideInterfaceTests.swift
0
Swift
1
none
16
51
51
true
Hide interface
2,044
CodeEditApp/CodeEdit
18,361
Swift
SimonKudsk
const EMPTY_DEPS: ReadonlyArray<unknown> = []; type RenderToolConfig<S extends z.ZodTypeAny> = { name: string; args?: S; render: ( props: | { name: string; args: Partial<z.infer<S>>; status: "inProgress"; result: undefined; } | { name: st...
these are repeated both here and below, maybe we could create interfaces for these 3 cases and also export them? Would allow users to create abstractions on top easier
const EMPTY_DEPS: ReadonlyArray<unknown> = []; export interface RenderToolInProgressProps<S extends z.ZodTypeAny> { name: string; args: Partial<z.infer<S>>; status: "inProgress"; result: undefined; } export interface RenderToolExecutingProps<S extends z.ZodTypeAny> { name: string; args: z.infer<S>; sta...
@@ -0,0 +1,116 @@ +import { useEffect } from "react"; +import { z } from "zod"; +import { useCopilotKit } from "../providers/CopilotKitProvider"; +import { defineToolCallRenderer } from "../types/defineToolCallRenderer"; +import { ReactToolCallRenderer } from "../types/react-tool-call-renderer"; + +const EMPTY_DEPS: Re...
src/v2.x/packages/react/src/hooks/use-render-tool.tsx
26
TypeScript
0.429
refactor
167
51
51
false
feat: use render tool on v2
3,174
CopilotKit/CopilotKit
23,852
TypeScript
AlemTuzlak
ranst91
}} > <div style={{ display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }}> <svg style={{ height: "14px", width: "14px", color: "#71717a", transition: "transform 0.15s", transf...
No issues found.
}} > <div style={{ display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }}> <svg style={{ height: "14px", width: "14px", color: "#71717a", transition: "transform 0.15s", transf...
@@ -0,0 +1,186 @@ +import React, { useState } from "react"; +import { useRenderTool } from "./use-render-tool"; + +type DefaultRenderProps = { + name: string; + args: any; + status: string; + result: string | undefined; +}; + +/** + * Registers a wildcard ("*") tool-call renderer via `useRenderTool`. + * + * - Call...
src/v2.x/packages/react/src/hooks/use-default-render-tool.tsx
0
TypeScript
1
none
16
51
51
true
feat: use render tool on v2
3,174
CopilotKit/CopilotKit
23,852
TypeScript
ranst91
from scipy.ndimage.morphology import binary_dilation from encoder.params_data import * from pathlib import Path from typing import Optional, Union import numpy as np import librosa import struct import warnings try: import webrtcvad except: print("WARNING: Unable to import 'webrtcvad'. Please install for bette...
```suggestion from warninings import warn ```
from scipy.ndimage.morphology import binary_dilation from encoder.params_data import * from pathlib import Path from typing import Optional, Union from warnings import warn import numpy as np import librosa import struct try: import webrtcvad except: warn("Unable to import 'webrtcvad'. This package enables noi...
@@ -5,10 +5,12 @@ import numpy as np import librosa import struct +import warnings
encoder/audio.py
8
Python
0.429
suggestion
47
33
33
false
Skip trim_long_silences in preprocess_wav if webrtcvad not available
376
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
from scipy.ndimage.morphology import binary_dilation from encoder.params_data import * from pathlib import Path from typing import Optional, Union import numpy as np import librosa import struct import warnings try: import webrtcvad except: print("WARNING: Unable to import 'webrtcvad'. Please install for bette...
```suggestion warn("Unable to import 'webrtcvad'. This package enables noise removal and is recommended.") ```
from scipy.ndimage.morphology import binary_dilation from encoder.params_data import * from pathlib import Path from typing import Optional, Union from warnings import warn import numpy as np import librosa import struct try: import webrtcvad except: warn("Unable to import 'webrtcvad'. This package enables noi...
@@ -5,10 +5,12 @@ import numpy as np import librosa import struct +import warnings try: import webrtcvad except: + print("WARNING: Unable to import 'webrtcvad'. Please install for better noise removal.")
encoder/audio.py
13
Python
0.714
suggestion
116
38
38
false
Skip trim_long_silences in preprocess_wav if webrtcvad not available
376
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
"Ideally, you should have all three. You should extract them as they are " "after having downloaded them and put them in a same directory, e.g.:\n" "-[datasets_root]\n" " -LibriSpeech\n" " -train-other-500\n" ...
too long name and too technical use "--no_trim" instead
"Ideally, you should have all three. You should extract them as they are " "after having downloaded them and put them in a same directory, e.g.:\n" "-[datasets_root]\n" " -LibriSpeech\n" " -train-other-500\n" ...
@@ -37,15 +36,27 @@ class MyFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptio parser.add_argument("-s", "--skip_existing", action="store_true", help=\ "Whether to skip existing output files with the same name. Useful if this script was " "interrupted.") + parser.add_argu...
encoder_preprocess.py
26
Python
0.286
refactor
56
51
51
false
Skip trim_long_silences in preprocess_wav if webrtcvad not available
376
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
if not args.no_sound: import sounddevice as sd print("Running a test of your configuration...\n") if torch.cuda.is_available(): device_id = torch.cuda.current_device() gpu_properties = torch.cuda.get_device_properties(device_id) ## Print some environment informa...
- Extract a function so you can reuse instead of duplicating the code - Use `and`s instead of chaining `if`s - Break the line above 100 chars
print_args(args, parser) if not args.no_sound: import sounddevice as sd print("Running a test of your configuration...\n") if torch.cuda.is_available(): device_id = torch.cuda.current_device() gpu_properties = torch.cuda.get_device_properties(device_id) ## P...
@@ -53,6 +53,12 @@ else: print("Using CPU for inference.\n") + ## Print helpful error message if models are not present + if not args.enc_model_fpath.is_file(): + if not args.syn_model_dir.is_dir(): + if not args.voc_model_fpath.is_file(): + print("Error: Model...
demo_cli.py
26
Python
0.571
refactor
143
51
51
false
Print helpful error message if models not found
416
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
import argparse import torch import sys if __name__ == '__main__': ## Info & args parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument("-e", "--enc_model_fpath", type=Path, default="encoder/saved_models/pretrain...
Change "repeatable" to "deterministic" everywhere, that's more precise
import argparse import torch import sys if __name__ == '__main__': ## Info & args parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument("-e", "--enc_model_fpath", type=Path, default="encoder/saved_models/pretrain...
@@ -32,12 +32,13 @@ "overhead but allows to save some GPU memory for lower-end GPUs.") parser.add_argument("--no_sound", action="store_true", help=\ "If True, audio won't be played.") + parser.add_argument("--seed", type=int, default=None, help=\ + "Optional random number seed value for...
demo_cli.py
26
Python
0.286
suggestion
70
51
51
false
384 repeatable voice cloning
432
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
from multiprocessing.pool import Pool from synthesizer import audio from functools import partial from itertools import chain from encoder import inference as encoder from pathlib import Path from utils import logmmse from tqdm import tqdm import numpy as np import librosa def preprocess_dataset(datasets_root: Path,...
Why not ```suggestion input_dirs = [dataset_root.joinpath(subfolder.strip()) for subfolder in subfolders.split(",")] ```
from multiprocessing.pool import Pool from synthesizer import audio from functools import partial from itertools import chain from encoder import inference as encoder from pathlib import Path from utils import logmmse from tqdm import tqdm import numpy as np import librosa def preprocess_dataset(datasets_root: Path,...
@@ -10,12 +10,13 @@ import librosa -def preprocess_librispeech(datasets_root: Path, out_dir: Path, n_processes: int, - skip_existing: bool, hparams): +def preprocess_dataset(datasets_root: Path, out_dir: Path, n_processes: int, + skip_existing: bool, hparams, no...
synthesizer/preprocess.py
19
Python
0.714
suggestion
127
44
44
false
Add synthesizer preprocessing support for other datasets
441
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
CorentinJ
ghost
from synthesizer.hparams import hparams from utils.argutils import print_args from pathlib import Path import argparse if __name__ == "__main__": parser = argparse.ArgumentParser( description="Preprocesses audio files from datasets, encodes them as mel spectrograms " "and writes them t...
No issues found.
from synthesizer.hparams import hparams from utils.argutils import print_args from pathlib import Path import argparse if __name__ == "__main__": parser = argparse.ArgumentParser( description="Preprocesses audio files from datasets, encodes them as mel spectrograms " "and writes them t...
@@ -24,8 +24,10 @@ "interrupted.") parser.add_argument("--hparams", type=str, default="", help=\ "Hyperparameter overrides as a comma-separated list of name-value pairs") + parser.add_argument("--no_trim", action="store_true", help=\ + "Preprocess audio without trimming silences (not re...
synthesizer_preprocess_audio.py
0
Python
1
none
16
51
51
true
Skip trim_long_silences in preprocess_wav if webrtcvad not available
376
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
ghost
from pathlib import Path def check_model_paths(encoder_path: Path, synthesizer_path: Path, vocoder_path: Path): # This function tests the model paths and makes sure at least one is valid. if encoder_path.is_file() or encoder_path.is_dir(): return if synthesizer_path.is_file() or synthesizer_path.is...
No issues found.
from pathlib import Path def check_model_paths(encoder_path: Path, synthesizer_path: Path, vocoder_path: Path): # This function tests the model paths and makes sure at least one is valid. if encoder_path.is_file() or encoder_path.is_dir(): return if synthesizer_path.is_file() or synthesizer_path.is...
@@ -0,0 +1,15 @@ +from pathlib import Path + +def check_model_paths(encoder_path: Path, synthesizer_path: Path, vocoder_path: Path): + # This function tests the model paths and makes sure at least one is valid. + if encoder_path.is_file() or encoder_path.is_dir(): + return + if synthesizer_path.is_file(...
utils/modelutils.py
0
Python
1
none
16
16
16
true
Print helpful error message if models not found
416
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
ghost
# Select the next utterance if self.ui.auto_next_checkbox.isChecked(): self.ui.browser_select_next() elif fpath == "": return else: name = fpath.name speaker_name = fpath.parent.name # Get the wav from the disk...
No issues found.
# Select the next utterance if self.ui.auto_next_checkbox.isChecked(): self.ui.browser_select_next() elif fpath == "": return else: name = fpath.name speaker_name = fpath.parent.name # Get the wav from the disk...
@@ -8,6 +8,7 @@ import numpy as np import traceback import sys +import torch # Use this directory structure for your datasets, or modify it to fit your needs @@ -38,7 +39,7 @@ MAX_WAVES = 15 class Toolbox: - def __init__(self, datasets_root, enc_models_dir, syn_models_dir, voc_models_dir, low_mem): + ...
toolbox/__init__.py
0
Python
1
none
16
51
51
true
384 repeatable voice cloning
432
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
ghost
if __name__ == "__main__": parser = argparse.ArgumentParser( description="Preprocesses audio files from datasets, encodes them as mel spectrograms " "and writes them to the disk. Audio files are also saved, to be used by the " "vocoder for training.", forma...
No issues found.
if __name__ == "__main__": parser = argparse.ArgumentParser( description="Preprocesses audio files from datasets, encodes them as mel spectrograms " "and writes them to the disk. Audio files are also saved, to be used by the " "vocoder for training.", forma...
@@ -1,4 +1,4 @@ -from synthesizer.preprocess import preprocess_librispeech +from synthesizer.preprocess import preprocess_dataset from synthesizer.hparams import hparams from utils.argutils import print_args from pathlib import Path @@ -26,6 +26,13 @@ "Hyperparameter overrides as a comma-separated list of n...
synthesizer_preprocess_audio.py
0
Python
1
none
16
51
51
true
Add synthesizer preprocessing support for other datasets
441
CorentinJ/Real-Time-Voice-Cloning
56,029
Python
ghost
if(getStarsFromProperties(burning.properties) == 0) { // 1 star require(wbp.lowStarBurnPoints < 100, "Low star burn points are capped"); wbp.lowStarBurnPoints = uint8(burnPointMultiplier.mul((wbp.lowStarBurnPoints < 10) ? 2 : 1) .add(wbp.lowStarBurnPoints)); ...
Since the code that clamps each value to the cap is all done before this, it is entirely possible for each of these bonuses to exceed the cap. This is probably not what we want.
wbp.lowStarBurnPoints = uint8(burnPointMultiplier.mul((wbp.lowStarBurnPoints < 10) ? 2 : 1) .add(wbp.lowStarBurnPoints)); } else if(getStarsFromProperties(burning.properties) == 1) { // 2 star require(wbp.lowStarBurnPoints < 100, "Low star burn points are capped")...
@@ -416,6 +421,10 @@ contract Weapons is Initializable, ERC721Upgradeable, AccessControlUpgradeable, if(wbp.fiveStarBurnPoints > 10) wbp.fiveStarBurnPoints = 10; } + wbp.lowStarBurnPoints = uint8(carriedLowStarBurnPoints.add(wbp.lowStarBurnPoints)); + wbp.fourStarBur...
contracts/weapons.sol
26
Solidity
0.429
suggestion
177
51
51
false
reforging reforged items should give a reduced bonus to the new item
145
CryptoBlades/cryptoblades
321
Vue
raymond-h
kcper
</div> </li> </ul> </div> </template> <script lang="ts"> import Vue from 'vue'; import { Accessors, PropType } from 'vue/types/options'; import { mapActions, mapGetters, mapState } from 'vuex'; import { IState, IWeapon } from '../../interfaces'; import WeaponIcon from '../WeaponIcon.vue'; type S...
can you find a way to define this globally so it's not in every component that uses it?
<ul class="weapon-grid"> <li class="weapon" :class="{ selected: highlight !== null && weapon.id === highlight }" v-for="weapon in nonIgnoredWeapons" :key="weapon.id" @click="$emit('choose-weapon', weapon.id)" @contextmenu="canFavorite && toggleFavorite($event, w...
@@ -57,6 +54,9 @@ interface StoreMappedActions { fetchWeapons(weaponIds: string[]): Promise<void>; } +Vue.directive('visible', (el, bind) => {
frontend/src/components/smart/WeaponGrid.vue
26
Vue
0.286
question
87
51
51
false
market pagination
155
CryptoBlades/cryptoblades
321
Vue
seiyria
kcper
import { ICharacter, ITarget, IWeapon, WeaponTrait, WeaponElement } from './interfaces'; export function traitNumberToName(traitNum: number): string { switch(traitNum) { case WeaponElement.Fire: return 'Fire'; case WeaponElement.Earth: return 'Earth'; case WeaponElement.Water: return 'Water...
do these numbers line up with our enum?
import { ICharacter, ITarget, IWeapon, WeaponTrait, WeaponElement } from './interfaces'; export function traitNumberToName(traitNum: number): string { switch(traitNum) { case WeaponElement.Fire: return 'Fire'; case WeaponElement.Earth: return 'Earth'; case WeaponElement.Water: return 'Water...
@@ -11,6 +11,16 @@ export function traitNumberToName(traitNum: number): string { } } +export function traitNameToNumber(traitName: string): number { + switch(traitName) {
frontend/src/contract-models.ts
15
TypeScript
0.071
question
39
40
40
false
market pagination
155
CryptoBlades/cryptoblades
321
Vue
seiyria
kcper
this.selectedNftId = null; this.waitingMarketOutcome = false; this.marketOutcome = 'Successfully changed price for ' +this.activeType+' '+results.nftID+' to '+this.convertWeiToSkill(results.newPrice)+' SKILL'; }, async updateNftListingTargetBuyer() { this.marketOutcome = null;...
you could use template strings for this (`) to make it cleaner, like you did above
</template> <div v-if="historyCounter > 0"> <b-table class="transaction-history-text" :items="shieldTransactionHistoryData" :fields="sieldTransactionHistoryHeader"></b-table> </div> <div v-if="historyCounter === 0"> ...
@@ -531,6 +591,28 @@ export default Vue.extend({ +this.activeType+' '+results.nftID+' to '+this.convertWeiToSkill(results.newPrice)+' SKILL'; }, + async updateNftListingTargetBuyer() { + + this.marketOutcome = null; + if(this.selectedNftId === null) return; + + let targetBuyer = await ...
frontend/src/views/Market.vue
26
Vue
0.429
suggestion
82
51
51
false
Allow private trades on market
194
CryptoBlades/cryptoblades
321
Vue
seiyria
kcper
bytes32 public constant GAME_ADMIN = keccak256("GAME_ADMIN"); // ############ // Initializer // ############ function initialize(IERC20 _skillToken, address _taxRecipient) public initializer { __AccessControl_init(); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); ...
Adding this field will almost certainly cause problems wrt upgradeability of the contract. Instead, there should be a new multi-level mapping, similar to `listings` below, exclusively for the `targetBuyer` of a particular listing.
using SafeERC20 for IERC20; bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; bytes32 public constant GAME_ADMIN = keccak256("GAME_ADMIN"); // ############ // Initializer // ############ function initialize(IERC20 _skillToken, address _taxRecipient) public initial...
@@ -51,6 +51,7 @@ contract NFTMarket is address seller; uint256 price; //int128 usdTether; // this would be to "tether" price dynamically to our oracle + address targetBuyer;
contracts/NFTMarket.sol
26
Solidity
0.643
suggestion
230
51
51
false
Allow private trades on market
194
CryptoBlades/cryptoblades
321
Vue
raymond-h
kcper
<template> <div class="body main-font"> <b-tabs justified> <b-tab @click="clearData()"> <template #title> Browse NFTs <hint class="hint" text="NFT stands for Non Fungible Token.<br>Weapons and Characters are NFTs of the ERC721 standard" /> </template> <div class...
Instead of doing `this as any`, the definition in `shims-vue.d.ts` should in theory make sure `$dialog` exists as a field already on `this` (the type of `this.$dialog` as per said file *is* just `any` anyway, but that's another issue). Would it be possible to remove the `as any` cast here?
if(this.selectedNftId === null) return; const val = Math.min(+this.listingSellPrice, 10000); if(val <= 0 || !val || isNaN(val)) return; this.waitingMarketOutcome = true; const results = await this.changeMarketListingPrice({ nftContractAddr: this.contractAddress, tokenId:...
@@ -527,8 +586,28 @@ export default Vue.extend({ this.selectedNftId = null; this.waitingMarketOutcome = false; - this.marketOutcome = 'Successfully changed price for ' - +this.activeType+' '+results.nftID+' to '+this.convertWeiToSkill(results.newPrice)+' SKILL'; + this.marketOutcome = `...
frontend/src/views/Market.vue
26
Vue
0.786
question
290
850
51
false
Allow private trades on market
194
CryptoBlades/cryptoblades
321
Vue
raymond-h
kcper
const price = await this.lookupNftPrice(this.search); if(price !== '0') { this.searchResults = await this.filterOutTargetBuyers([this.search]) as string[]; } else { this.searchResults = []; } this.waitingMarketOutcome = false; this.marketOutcome = null; }, ...
I assume this cast was added because the type for `filterOutTargetBuyers` was somehow not picked up. Did you try explicitly specifying the return type on the `filterOutTargetBuyers` method itself?
import { Accessors } from 'vue/types/options'; import { Contract, Contracts, IState } from '../interfaces'; import { Characters, Weapons, Shields } from '../../../build/abi-interfaces'; import { SkillShopListing } from '../interfaces/SkillShopListing'; import BigNumber from 'bignumber.js'; import { traitNameToNumber } ...
@@ -633,7 +713,7 @@ export default Vue.extend({ this.searchResultsOwned = this.search === this.defaultAccount; this.waitingMarketOutcome = false; - this.searchResults = result; + this.searchResults = await this.filterOutTargetBuyers(result) as string[];
frontend/src/views/Market.vue
26
Vue
0.714
question
196
51
51
false
Allow private trades on market
194
CryptoBlades/cryptoblades
321
Vue
raymond-h
kcper
uint256 price; //int128 usdTether; // this would be to "tether" price dynamically to our oracle } // ############ // State // ############ IERC20 public skillToken; //0x154A9F9cbd3449AD22FDaE23044319D6eF2a1Fab; address public taxRecipient; //game contract //IPriceOracle publ...
New state variables need to be added after all existing ones for upgradeability reasons.
function migrateTo_a98a9ac(Characters _charactersContract, Weapons _weaponsContract) external { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); characters = _charactersContract; weapons = _weaponsContract; } function migrateTo_2316231(IPriceOracle _priceOracleSkillPe...
@@ -64,6 +64,8 @@ contract NFTMarket is mapping(address => mapping(uint256 => Listing)) private listings; // address is IERC721 -- kept like this because of OpenZeppelin upgrade plugin bug mapping(address => EnumerableSet.UintSet) private listedTokenIDs; + // keeps target buyer for nftId of specific t...
contracts/NFTMarket.sol
26
Solidity
0.214
suggestion
88
51
51
false
Allow private trades on market
194
CryptoBlades/cryptoblades
321
Vue
raymond-h
kcper
struct WeaponCosmetics { uint8 version; uint256 seed; } Weapon[] private tokens; WeaponCosmetics[] private cosmetics; mapping(uint256 => WeaponBurnPoints) burnPoints; uint public burnPointMultiplier; // 2 uint public lowStarBurnPowerPerPoint; // 15 uint public fourStarB...
State variables cannot be removed, ever. The `override` keyword should be fine to remove however.
struct WeaponCosmetics { uint8 version; uint256 seed; } Weapon[] private tokens; WeaponCosmetics[] private cosmetics; mapping(uint256 => WeaponBurnPoints) burnPoints; uint public burnPointMultiplier; // 2 uint public lowStarBurnPowerPerPoint; // 15 uint public fourStar...
@@ -95,8 +89,6 @@ contract Weapons is Initializable, ERC721Upgradeable, AccessControlUpgradeable, int128 public powerMultPerPointPWR; // 0.2575% (+3%) int128 public powerMultPerPointMatching; // 0.2675% (+7%) - mapping(uint256 => uint256) public override lastTransferTimestamp;
contracts/weapons.sol
26
Solidity
0.429
suggestion
97
51
51
false
Remove transfer cooldown from weapons
298
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
pragma solidity ^0.6.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "../node_modules/@openzeppelin/contracts/math/SafeMath....
I would like to keep this constant for now, as it is used in `migrations/29_transfer_cooldown.js`. While that is an old migration, and this constant won't actually be applicable in any way after this PR is merged, I would like to leave all applied migration files untouched for now. Eventually I would like to merge a...
pragma solidity ^0.6.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "../node_modules/@openzeppelin/contracts/math/SafeMath....
@@ -6,17 +6,13 @@ import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol" import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; import "../node_modules/abdk-libraries-solidity/ABDKMath64x64.sol"; import "./util.sol"; -import "./interfaces/ITransferCooldownable.sol"; -contract...
contracts/weapons.sol
17
Solidity
0.643
refactor
455
42
42
false
Remove transfer cooldown from weapons
298
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
<template> <div class="body main-font"> <b-navbar-nav> <b-nav-item-dropdown right> <template #button-content> <i class="fa fa-cog"></i> </template> <b-dropdown-item @click="toggleGraphics()">3D Graphics: {{ showGraphics ? 'On' : 'Off' }}</b-dropdown-item> <b-dropd...
this will need the google analytics stuff - `gtag-link-others` and `tagname` (I think that's all it needs to be picked up).
<template> <div class="body main-font"> <b-navbar-nav> <b-nav-item-dropdown right> <template #button-content> <i class="fa fa-bars"></i> </template> <b-dropdown-group> <b-dropdown-header>Links</b-dropdown-header> <b-dropdown-item @click="claimSkill(ClaimS...
@@ -16,6 +16,8 @@ <b-dropdown-item @click="claimSkill(ClaimStage.WaxBridge)">Claim Skill </b-dropdown-item> + <b-dropdown-item @click.native="$router.push('leaderboard')">Leaderboard </b-dropdown-item>
frontend/src/components/Options.vue
19
Vue
0.5
suggestion
123
44
44
false
236-navbar-clean-up
304
CryptoBlades/cryptoblades
321
Vue
seiyria
bilbolPrime
@click="activeType = 'character'" class="gtag-link-others" tagname="show_characters_market">Show Characters</b-button> </div> <div class="col"> <b-button variant="primary" v-if="activeType === 'weapon'" ...
lets do this a better way. set a `max` value on the form input, and do a `Math.min()` when doing a submit. It'd be doubly good if this was enforced at a contract level, but I'm not sure that will be necessary.
@click="activeType = 'character'" class="gtag-link-others" tagname="show_characters_market">Show Characters</b-button> </div> <div class="col"> <b-button variant="primary" v-if="activeType === 'weapon'" ...
@@ -274,15 +274,25 @@ v-if="activeType === 'weapon'" class="gtag-link-others" tagname="add_listing_weapon" :disabled="selectedNftId === null || selectedNftOnCooldown" - @click="addListingForNft()">List Weapon <b-icon-question-circle :hidden=!wea...
frontend/src/views/Market.vue
26
Vue
0.643
suggestion
209
51
51
false
fix(market): prevent listings over 10000 skill on the client side
335
CryptoBlades/cryptoblades
321
Vue
seiyria
kcper
}, clearFilters() { sessionStorage.clear(); this.elementFilter = ''; this.levelFilter = ''; this.priceSort = ''; this.$emit('character-filters-changed'); }, priceSortText(type) { if (type === '1') { return 'Price: Low -> High'; } else if (type === '-...
please do not change where things are stored. they should stay in localstorage for now.
localStorage.setItem('character-levelfilter', this.levelFilter); localStorage.setItem('character-elementfilter', this.elementFilter); if(this.isMarket) { sessionStorage.setItem('character-price-order', this.priceSort); } this.$emit('character-filters-changed'); }, clearFi...
@@ -165,15 +155,24 @@ export default { this.$emit('character-filters-changed'); }, + + priceSortText(type) { + if (type === '1') { + return 'Price: Low -> High'; + } else if (type === '-1') { + return 'Price: High -> Low'; + } + return 'Any'; + }, }, compone...
frontend/src/components/smart/CharacterList.vue
26
Vue
0.286
suggestion
87
51
51
false
fix(selectors): pagination should work correctly for all cases
364
CryptoBlades/cryptoblades
321
Vue
seiyria
pohika
methods: { ...mapActions(['fetchCharacters']), getCharacterArt, saveFilters() { sessionStorage.setItem('character-levelfilter', this.levelFilter); sessionStorage.setItem('character-elementfilter', this.elementFilter); if(this.isMarket) { sessionStorage.setItem('character-price...
this could be done a bit better: ``` const sorts = [ { name: 'Any', dir: 0 }, { name: 'Price: Low -> High', dir: 1 }, { name: 'Price: High -> Low', dir: -1 }, ] ``` then use that. then we can add more sorts later without so much boilerplate.
watch: { async characterIdsToDisplay(characterIds) { await this.fetchCharacters(characterIds); } }, methods: { ...mapActions(['fetchCharacters']), getCharacterArt, saveFilters() { localStorage.setItem('character-levelfilter', this.levelFilter); localStorage.setItem('chara...
@@ -165,15 +155,24 @@ export default { this.$emit('character-filters-changed'); }, + + priceSortText(type) {
frontend/src/components/smart/CharacterList.vue
26
Vue
0.857
suggestion
254
51
51
false
fix(selectors): pagination should work correctly for all cases
364
CryptoBlades/cryptoblades
321
Vue
seiyria
pohika
getFavoritesMap(favorites: string): Record<number, boolean> { if (!favorites) { return {}; } const favoritesMap: Record<number, boolean> = {}; favorites.split(',').forEach((x) => (favoritesMap[+x] = true)); return favoritesMap; }, isFavorite(weaponId: number): boolea...
same as above, use the sorts array instead of this so we don't need this function - I'm not sure why it's here twice.
localStorage.setItem('favorites', this.getFavoritesString(this.favorites)); }, getFavoritesString(favorites: Record<number, boolean>): string { return JSON.stringify(favorites); }, getFavoritesMap(favorites: string): Record<number, boolean> { if (!favorites) { return {}; ...
@@ -272,6 +263,15 @@ export default Vue.extend({ this.$emit('weapon-filters-changed'); }, + priceSortText(type: string): string {
frontend/src/components/smart/WeaponGrid.vue
26
Vue
0.429
suggestion
117
51
51
false
fix(selectors): pagination should work correctly for all cases
364
CryptoBlades/cryptoblades
321
Vue
seiyria
pohika
async cancelNftListing() { this.marketOutcome = null; if(this.selectedNftId === null) return; this.waitingMarketOutcome = true; const results = await this.cancelMarketListing({ nftContractAddr: this.contractAddress, tokenId: this.selectedNftId, }); this.waiti...
`=== true` is superfluous in this case
async cancelNftListing() { this.marketOutcome = null; if(this.selectedNftId === null) return; this.waitingMarketOutcome = true; const results = await this.cancelMarketListing({ nftContractAddr: this.contractAddress, tokenId: this.selectedNftId, }); this.waiti...
@@ -675,6 +676,21 @@ export default Vue.extend({ this.marketOutcome = null; this.waitingMarketOutcome = true; + if(useBlockchain === true)
frontend/src/views/Market.vue
26
Vue
0.214
suggestion
38
51
51
false
feat(localdevelopment): can now use blockchain for local dev market testing
369
CryptoBlades/cryptoblades
321
Vue
seiyria
bilbolPrime
} function migrateTo_23b3a8b(IStakeFromGame _stakeFromGame) external { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); stakeFromGameImpl = _stakeFromGame; } function migrateTo_7dd2a56() external { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); ...
State variables can never be removed due to proxy contract upgradeability. Instead, add `// UNUSED; KEPT FOR UPGRADEABILITY PROXY COMPATIBILITY` as a note above it.
} function migrateTo_23b3a8b(IStakeFromGame _stakeFromGame) external { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); stakeFromGameImpl = _stakeFromGame; } function migrateTo_7dd2a56() external { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); ...
@@ -85,7 +84,6 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { } // config vars - uint characterLimit;
contracts/cryptoblades.sol
26
Solidity
0.571
suggestion
164
51
51
false
PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
389
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
uint256 baseSeed = RandomUtil.combineSeeds( RandomUtil.combineSeeds(staminaTimestamp, currentHour), playerPower ); uint32[4] memory targets; for(uint i = 0; i < targets.length; i++) { // we alter seed per-index or they would be all the sam...
I believe state variables of other contracts cannot be accessed like this. They need to be treated like getter functions. Also requires the state variable in question to be `public`. ```suggestion require(characters.balanceOf(msg.sender) < characters.characterLimit(), string(abi.encodePacked("Y...
getPlayerPower(characters.getPower(char), weaponMultTarget, weaponBonusPower), characters.getStaminaTimestamp(char), getCurrentHour() ); } function getTargetsInternal(uint24 playerPower, uint64 staminaTimestamp, uint256 currentHour ) private pure ...
@@ -388,8 +386,8 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { } function mintCharacter() public doesNotHaveMoreThanMaxCharacters oncePerBlock(msg.sender) requestPayFromPlayer(mintCharacterFee) { - require(characters.balanceOf(msg.sender) < characterLimit, - string(...
contracts/cryptoblades.sol
26
Solidity
0.786
suggestion
390
51
51
false
PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
389
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
randoms = _newRandoms; } modifier restricted() { require(hasRole(GAME_ADMIN, msg.sender), "Missing GAME_ADMIN role"); _; } modifier oncePerBlock(address user) { require(lastBlockNumberCalled[user] < block.number, "Only callable once per block"); lastBlockNumberC...
I believe state variables of other contracts cannot be accessed like this. They need to be treated like getter functions. Also requires the state variable in question to be `public`. ```suggestion require(characters.balanceOf(msg.sender) <= characters.characterLimit(), "Too many characters owned"); ```
uint256 seed = randoms.getRandomSeed(msg.sender); weapons.mint(msg.sender, seed); } function reforgeWeapon(uint256 reforgeID, uint256 burnID) public doesNotHaveMoreThanMaxCharacters isWeaponOwner(reforgeID) isWeaponOwner(burnID) requestPayFromPlayer(reforgeWeaponFee) { ...
@@ -452,7 +450,7 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { } modifier doesNotHaveMoreThanMaxCharacters() { - require(characters.balanceOf(msg.sender) <= characterLimit, "Too many characters owned"); + require(characters.balanceOf(msg.sender) <= characters.characterL...
contracts/cryptoblades.sol
26
Solidity
0.786
suggestion
316
51
51
false
PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
389
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
*/ struct Character { uint16 xp; // xp to next level uint8 level; // up to 256 cap uint8 trait; // 2b trait, TBD uint64 staminaTimestamp; // standard timestamp in seconds-resolution marking regen start from 0 } struct CharacterCosmetics { uint8 version; u...
`uint` is shorthand for `uint256`, and I realize the original code in `cryptoblades.sol` itself used `uint` for this, but I think we should prefer explicitly stating it. ```suggestion uint256 characterLimit; ```
/* visual numbers start at 0, increment values by 1 levels: 1-256 traits: 0-3 [0(fire) > 1(earth) > 2(lightning) > 3(water) > repeat] */ struct Character { uint16 xp; // xp to next level uint8 level; // up to 256 cap uint8 trait; // 2b trait, TBD uint...
@@ -95,6 +97,8 @@ contract Characters is Initializable, ERC721Upgradeable, AccessControlUpgradeabl Promos public promos; + uint characterLimit;
contracts/characters.sol
26
Solidity
0.857
suggestion
220
51
51
false
PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
389
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; import "./Promos.so...
For now I don't intend to enforce it, but for the future: initialization of new state variables have to be done by a brand-new function as the initializer function was called exactly once - during the first deploy - and will never be called again. Our convention has been to add a `migrateTo_XXXXXXX` function that ge...
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./Promos.sol"; import "./ut...
@@ -24,6 +24,8 @@ contract Characters is Initializable, ERC721Upgradeable, AccessControlUpgradeabl __AccessControl_init_unchained(); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); + + characterLimit = 4;
contracts/characters.sol
26
Solidity
0.643
suggestion
645
51
51
false
PVE008: Move characterLimit member from cryptoblades.sol to characters.sol
389
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
_updateListedTokenTypes(_tokenAddress); _tokenAddress.safeTransferFrom(address(this), msg.sender, _id); emit CancelledListing(msg.sender, _tokenAddress, _id); } function purchaseListing( IERC721 _tokenAddress, uint256 _id, uint256 _maxPrice ) public userNot...
Requires import and usage of `SafeERC20`.
listedTokenIDs[address(_tokenAddress)].remove(_id); _updateListedTokenTypes(_tokenAddress); _tokenAddress.safeTransferFrom(address(this), msg.sender, _id); emit CancelledListing(msg.sender, _tokenAddress, _id); } function purchaseListing( IERC721 _tokenAddress, ...
@@ -488,8 +488,8 @@ contract NFTMarket is listedTokenIDs[address(_tokenAddress)].remove(_id); _updateListedTokenTypes(_tokenAddress); - skillToken.transferFrom(msg.sender, taxRecipient, taxAmount); - skillToken.transferFrom( + skillToken.safeTransferFrom(msg.sender, taxRecipient...
contracts/NFTMarket.sol
26
Solidity
0.214
suggestion
41
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
} function setTaxOnTokenTypeAsPercent( IERC721 _tokenAddress, uint256 _percent ) public restricted isValidERC721(_tokenAddress) { _setTaxOnTokenType( _tokenAddress, ABDKMath64x64.divu(_percent, 100) ); } function setUserBan(address user, bool...
Use `safeTransfer` from `SafeERC20` instead.
ABDKMath64x64.divu(_numerator, _denominator) ); } function setTaxOnTokenTypeAsPercent( IERC721 _tokenAddress, uint256 _percent ) public restricted isValidERC721(_tokenAddress) { _setTaxOnTokenType( _tokenAddress, ABDKMath64x64.divu(_percen...
@@ -566,7 +566,7 @@ contract NFTMarket is } function recoverSkill(uint256 amount) public restricted { - skillToken.transfer(msg.sender, amount); // dont expect we'll hold tokens here but might as well + skillToken.safeTransferFrom(address(this), msg.sender, amount); // dont expect we'll hold t...
contracts/NFTMarket.sol
26
Solidity
0.286
suggestion
44
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
mapping(address => uint256) lastBlockNumberCalled; uint256 public fightXpGain; // multiplied based on power differences mapping(address => uint256) tokenRewards; // user adress : skill wei mapping(uint256 => uint256) xpRewards; // character id : xp int128 public oneFrac; // 1.0 int128 public ...
Use `safeTransfer` from `SafeERC20` instead.
int128 public fightRewardBaseline; int128 public fightRewardGasOffset; int128 public mintWeaponFee; int128 public reforgeWeaponFee; uint256 nonce; mapping(address => uint256) lastBlockNumberCalled; uint256 public fightXpGain; // multiplied based on power differences mapping(address ...
@@ -128,7 +128,7 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { function recoverSkill(uint256 amount) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not admin"); - skillToken.transfer(msg.sender, amount); + skillToken.safeTransferFrom(address(this), msg.s...
contracts/cryptoblades.sol
26
Solidity
0.286
suggestion
44
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
// must use requestPayFromPlayer modifier to approve on the initial function! totalInGameOnlyFunds = totalInGameOnlyFunds.sub(fromInGameOnlyFunds); inGameOnlyFunds[playerAddress] = inGameOnlyFunds[playerAddress].sub(fromInGameOnlyFunds); tokenRewards[playerAddress] = tokenRewards[playe...
Requires import and usage of `SafeERC20`.
_approveContractCharacterFor(characterID, playerAddress); } function approveContractWeaponFor(uint256 weaponID, address playerAddress) public restricted { _approveContractWeaponFor(weaponID, playerAddress); } function _payContract(address playerAddress, int128 usdAmount) internal { ...
@@ -525,15 +525,15 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { inGameOnlyFunds[playerAddress] = inGameOnlyFunds[playerAddress].sub(fromInGameOnlyFunds); tokenRewards[playerAddress] = tokenRewards[playerAddress].sub(fromTokenRewards); - skillToken.transferFrom(playerA...
contracts/cryptoblades.sol
26
Solidity
0.214
suggestion
41
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
function _giveInGameOnlyFundsFromContractBalance(address to, uint256 skillAmount) internal { totalInGameOnlyFunds = totalInGameOnlyFunds.add(skillAmount); inGameOnlyFunds[to] = inGameOnlyFunds[to].add(skillAmount); emit InGameOnlyFundsGiven(to, skillAmount); } function giveInGameO...
Requires import and usage of `SafeERC20`.
function setStaminaCostFight(uint8 points) public restricted { require(points >= 20, "StaminaCostFight too low"); require(points <= 50, "StaminaCostFight too high"); staminaCostFight = points; } function setDurabilityCostFight(uint8 points) public restricted { durabilityCos...
@@ -580,7 +580,7 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { totalInGameOnlyFunds = totalInGameOnlyFunds.add(skillAmount); inGameOnlyFunds[to] = inGameOnlyFunds[to].add(skillAmount); - skillToken.transferFrom(msg.sender, address(this), skillAmount); + skillTok...
contracts/cryptoblades.sol
26
Solidity
0.214
suggestion
41
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
_payContractConverted(playerAddress, usdToSkill(usdAmount)); } function _payContractConverted(address playerAddress, uint256 convertedAmount) internal { (uint256 fromInGameOnlyFunds, uint256 fromTokenRewards, uint256 fromUserWallet) = getSkillToSubtract( inGameOnlyF...
Use `safeTransfer` from `SafeERC20` instead.
} function payPlayer(address playerAddress, int128 baseAmount) public restricted { _payPlayer(playerAddress, baseAmount); } function payPlayerConverted(address playerAddress, uint256 convertedAmount) public restricted { _payPlayerConverted(playerAddress, convertedAmount); } fu...
@@ -525,15 +525,15 @@ contract CryptoBlades is Initializable, AccessControlUpgradeable { inGameOnlyFunds[playerAddress] = inGameOnlyFunds[playerAddress].sub(fromInGameOnlyFunds); tokenRewards[playerAddress] = tokenRewards[playerAddress].sub(fromTokenRewards); - skillToken.transferFrom(playerA...
contracts/cryptoblades.sol
26
Solidity
0.286
suggestion
44
51
51
false
PVE003: Use safeTransferFrom instead of transfer and transferFrom
391
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
pragma solidity ^0.6.2; import "../@openzeppelin/contracts/math/Math.sol"; import "../@openzeppelin/contracts/math/SafeMath.sol"; import "../@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // Inheritance import "./interfaces/IStakingRewards.sol"; impo...
Leftover `../` that need to be removed also.
pragma solidity ^0.6.2; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // Inheritance import "./interfaces/IStakingRewards.sol"; import "./Reward...
@@ -1,9 +1,9 @@ pragma solidity ^0.6.2; -import "../../node_modules/@openzeppelin/contracts/math/Math.sol"; -import "../../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; -import "../../node_modules/@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; -import "../../node_modules/@openzeppelin/contracts/utils...
contracts/staking/StakingRewards.sol
6
Solidity
0.286
suggestion
44
31
31
false
Simplify imports in contrats\*.sol
392
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man
pragma solidity ^0.6.2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "../@openzeppelin/contracts/math/Math.sol"; import "../@ope...
Leftover `../` that need to be removed also.
pragma solidity ^0.6.2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppe...
@@ -3,9 +3,9 @@ pragma solidity ^0.6.2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; -import "../../node_modules/@openzeppelin/contra...
contracts/staking/StakingRewardsUpgradeable.sol
8
Solidity
0.286
suggestion
44
33
33
false
Simplify imports in contrats\*.sol
392
CryptoBlades/cryptoblades
321
Vue
raymond-h
brian-man