Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
PRE_COMMIT_USE_MICROMAMBA: 1
steps:
- uses: actions/checkout@v4
- name: Install pre-commit
- name: Install pre-commit and identify
uses: mamba-org/setup-micromamba@v2
with:
environment-name: linters
create-args: pre-commit
create-args: pre-commit identify
- name: Add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> $GITHUB_PATH
- name: Run all linters
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: libmamba/tests/data/repodata_json_cache*
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -10,7 +10,7 @@ repos:
language_version: python3
# Autoformat: YAML, JSON, Markdown, etc.
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
rev: v3.6.2
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pygrep-hooks
Expand All @@ -20,29 +20,29 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.17.1
rev: v0.18.1
hooks:
- id: markdownlint-cli2
args: [--fix]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
rev: v0.14.0
hooks:
- id: ruff
- id: ruff-check
args: [--fix]
exclude_types: [pyi]
- id: ruff-format
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies: [black==24.10.0]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
rev: v21.1.2
hooks:
- id: clang-format
args: [--style=file]
Expand All @@ -52,7 +52,7 @@ repos:
hooks:
- id: cmake-format
- repo: https://github.com/Quantco/pre-commit-mirrors-typos
rev: 1.29.4
rev: 1.33.1
hooks:
- id: typos-conda
# In case of ambiguity (multiple possible corrections), `typos` will just report it to the user and move on without applying/writing any changes.
Expand Down
2 changes: 1 addition & 1 deletion libmamba/data/mamba.csh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if ("$__exe_name" == "micromamba") then
else if ("$__exe_name" == "mamba") then
alias micromamba __mamba_wrap
else
echo "Error unknow MAMBA_EXE: \"$MAMBA_EXE\", filename must be mamba or micromamba" >&2
echo "Error unknown MAMBA_EXE: \"$MAMBA_EXE\", filename must be mamba or micromamba" >&2
endif

if (! $?CONDA_SHLVL) then
Expand Down
12 changes: 8 additions & 4 deletions libmamba/ext/solv-cpp/src/pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,10 @@ namespace solv

// Set the callback
m_user_namespace_callback->callback = [wrapper = m_user_namespace_callback.get(),
callback = std::move(callback
)](ObjPoolView pool, StringId name, StringId ver
callback = std::move(callback)](
ObjPoolView pool,
StringId name,
StringId ver
) mutable noexcept -> OffsetId
{
auto error = std::exception_ptr(nullptr);
Expand All @@ -423,8 +425,10 @@ namespace solv
};

// Wrap the user callback in the libsolv function type that must cast the callback ptr
auto libsolv_callback = +[](::Pool* pool, void* user_data, StringId name, StringId ver
) noexcept -> OffsetId
auto libsolv_callback = +[](::Pool* pool,
void* user_data,
StringId name,
StringId ver) noexcept -> OffsetId
{
auto* user_namespace_callback = reinterpret_cast<NamespaceCallbackWrapper*>(user_data);
return user_namespace_callback->callback(ObjPoolView(pool), name, ver); // noexcept
Expand Down
15 changes: 7 additions & 8 deletions libmamba/ext/solv-cpp/src/solvable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ namespace solv
auto ObjSolvableViewConst::build_number() const -> std::size_t
{
return to_int_or<std::size_t>(
ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_BUILDVERSION)
),
ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_BUILDVERSION)),
0
);
}
Expand Down Expand Up @@ -176,7 +175,8 @@ namespace solv

auto ObjSolvableViewConst::file_name() const -> std::string_view
{
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIAFILE)
return ptr_to_strview(
::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIAFILE)
);
}

Expand Down Expand Up @@ -208,7 +208,8 @@ namespace solv

auto ObjSolvableViewConst::python_site_packages_path() const -> std::string_view
{
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIABASE)
return ptr_to_strview(
::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIABASE)
);
}

Expand Down Expand Up @@ -354,8 +355,7 @@ namespace solv

auto ObjSolvableViewConst::channel() const -> std::string_view
{
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_PACKAGER)
);
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_PACKAGER));
}

void ObjSolvableView::set_channel(raw_str_view str) const
Expand All @@ -370,8 +370,7 @@ namespace solv

auto ObjSolvableViewConst::platform() const -> std::string_view
{
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIADIR)
);
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIADIR));
}

void ObjSolvableView::set_platform(raw_str_view str) const
Expand Down
3 changes: 1 addition & 2 deletions libmamba/ext/solv-cpp/src/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ namespace solv

auto ObjTransaction::from_solver(const ObjPool& pool, const ObjSolver& solver) -> ObjTransaction
{
auto trans = ObjTransaction{ ::solver_create_transaction(const_cast<::Solver*>(solver.raw())
) };
auto trans = ObjTransaction{ ::solver_create_transaction(const_cast<::Solver*>(solver.raw())) };
assert_same_pool(pool, trans);
return trans;
}
Expand Down
7 changes: 5 additions & 2 deletions libmamba/include/mamba/api/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,11 @@ namespace mamba

void clear_rc_sources();

void
add_to_loading_sequence(std::vector<std::string>& seq, const std::string& name, std::vector<std::string>&);
void add_to_loading_sequence(
std::vector<std::string>& seq,
const std::string& name,
std::vector<std::string>&
);

static YAML::Node load_rc_file(const fs::u8path& file);

Expand Down
8 changes: 5 additions & 3 deletions libmamba/include/mamba/core/env_lockfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ namespace mamba
{
}

std::vector<specs::PackageInfo>
get_packages_for(std::string_view category, std::string_view platform, std::string_view manager)
const;
std::vector<specs::PackageInfo> get_packages_for(
std::string_view category,
std::string_view platform,
std::string_view manager
) const;

const std::vector<Package>& get_all_packages() const
{
Expand Down
11 changes: 8 additions & 3 deletions libmamba/include/mamba/fs/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,9 @@ namespace mamba::fs
mutable directory_entry current_entry;
};

static_assert(std::is_same_v<std::decay_t<decltype(*std::declval<directory_iterator>())>, directory_entry>);
static_assert(
std::is_same_v<std::decay_t<decltype(*std::declval<directory_iterator>())>, directory_entry>
);

inline directory_iterator begin(directory_iterator iter) noexcept
{
Expand Down Expand Up @@ -805,7 +807,9 @@ namespace mamba::fs
mutable directory_entry current_entry;
};

static_assert(std::is_same_v<std::decay_t<decltype(*std::declval<directory_iterator>())>, directory_entry>);
static_assert(
std::is_same_v<std::decay_t<decltype(*std::declval<directory_iterator>())>, directory_entry>
);

inline recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept
{
Expand Down Expand Up @@ -1311,7 +1315,8 @@ struct std::hash<::mamba::fs::u8path>
{
std::size_t operator()(const ::mamba::fs::u8path& path) const noexcept
{
return std::filesystem::hash_value(path.std_path()
return std::filesystem::hash_value(
path.std_path()
); // TODO: once we stop using gcc < 12 we can properly use
// std::hash<std::filesystem::path>{}(path.std_path());
}
Expand Down
5 changes: 3 additions & 2 deletions libmamba/include/mamba/util/flat_bool_expr_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ namespace mamba::util
}

template <typename V, typename O, typename C>
auto InfixParser<V, O, C>::stack_top_is_op_with_greater_precedence_than(const operator_type& op
) const -> bool
auto
InfixParser<V, O, C>::stack_top_is_op_with_greater_precedence_than(const operator_type& op) const
-> bool
{
if (stack_empty())
{
Expand Down
23 changes: 17 additions & 6 deletions libmamba/include/mamba/util/synchronized_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,23 @@ namespace mamba::util
return *this;
}

[[nodiscard]] auto operator*() -> T& requires(not readonly) { return *m_value; }
[[nodiscard]] auto operator*() -> T&
requires(not readonly)
{
return *m_value;
}

[[nodiscard]] auto operator*() const -> const T&
{
return *m_value;
}

[[nodiscard]] auto
operator->() -> T* requires(not readonly) { return m_value; }
[[nodiscard]] auto operator->() -> T*
requires(not readonly)
{
return m_value;
}

[[nodiscard]] auto operator->() const -> const T*
{
return m_value;
Expand Down Expand Up @@ -599,7 +608,9 @@ namespace mamba::util
///////////////////////////////////////////////////////////////////////////////////////////

template <std::default_initializable T, Mutex M>
synchronized_value<T, M>::synchronized_value() noexcept(std::is_nothrow_default_constructible_v<T>) = default;
synchronized_value<T, M>::synchronized_value() noexcept(
std::is_nothrow_default_constructible_v<T>
) = default;

template <std::default_initializable T, Mutex M>
synchronized_value<T, M>::synchronized_value(T value) noexcept
Expand Down Expand Up @@ -751,8 +762,8 @@ namespace mamba::util

template <std::default_initializable T, Mutex M>
auto
synchronized_value<T, M>::operator==(const weakly_equality_comparable_with<T> auto& other_value
) const -> bool
synchronized_value<T, M>::operator==(const weakly_equality_comparable_with<T> auto& other_value) const
-> bool
{
auto _ = lock_as_readonly(m_mutex);
return m_value == other_value;
Expand Down
Loading
Loading