Skip to content

Commit 2d5acb1

Browse files
committed
Add Stefan's review comments
1 parent 385b24a commit 2d5acb1

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

external-crates/move/crates/move-package-alt/src/dependency/dependency_set.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ impl<T> DependencySet<T> {
8383

8484
/// Convenience method to return either [default_deps] or [deps_for_env] depending on [env]; an
8585
/// [env] of [None] indicates a request for the default dependencies.
86+
/// TODO rename to deps
8687
pub fn deps_for(&self, env: Option<&EnvironmentName>) -> BTreeMap<PackageName, &T> {
8788
match env {
8889
Some(env) => self.deps_for_env(env),
@@ -133,6 +134,7 @@ impl<T> DependencySet<T> {
133134

134135
/// A copy of [self] expanded with an entry (package name, env, dep) for all
135136
/// packages in [self] and environments in [envs].
137+
/// TODO: rename to expand or extend
136138
pub fn explode(&mut self, envs: impl IntoIterator<Item = EnvironmentName>)
137139
where
138140
T: Clone,

external-crates/move/crates/move-package-alt/src/dependency/external.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct RField {
6060
}
6161

6262
/// Requests from the package mananger to the external resolver
63+
// TODO: fix typo above
6364
#[derive(Serialize, Debug)]
6465
struct ResolveRequest<F: MoveFlavor> {
6566
#[serde(default)]
@@ -134,6 +135,8 @@ impl ExternalDependency {
134135
}
135136
}
136137

138+
// TODO: CLEANUP
139+
// Explain this conversion
137140
impl TryFrom<RField> for ExternalDependency {
138141
type Error = PackageError;
139142

external-crates/move/crates/move-package-alt/src/dependency/git.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ use super::{DependencySet, Pinned, Unpinned};
4444
// writing `let x : Sha = ""` (whereas `let x = Sha::new("")` can fail)
4545
type Sha = String;
4646

47+
/// TODO keep same style around all types
48+
///
4749
/// A git dependency that is unpinned. The `rev` field can be either empty, a branch, or a sha. To
4850
/// resolve this into a [`PinnedGitDependency`], call `pin_one` function.
4951
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
@@ -181,6 +183,8 @@ impl GitRepo {
181183
/// Checkout the repository using a sparse checkout. It will try to clone without checkout, set
182184
/// sparse checkout directory, and then checkout the folder specified by `self.path` at the
183185
/// given sha.
186+
///
187+
// TODO think more about debug statements and what information to log
184188
async fn checkout_repo(&self, repo_fs_path: &PathBuf, sha: &str) -> PackageResult<()> {
185189
// Checkout repo if it does not exist already
186190
if !repo_fs_path.exists() {
@@ -278,6 +282,7 @@ impl GitRepo {
278282
}
279283

280284
/// Runs a git command from the provided arguments.
285+
// TODO: check for error codes here
281286
pub async fn run_git_cmd_with_args(
282287
&self,
283288
args: &[&str],
@@ -444,6 +449,8 @@ pub fn format_repo_to_fs_path(repo: &str, sha: &str, root_path: Option<PathBuf>)
444449

445450
/// Check if the given string is a valid commit SHA, i.e., 40 character long with only
446451
/// lowercase letters and digits
452+
///
453+
// TODO: rename this function to is_sha
447454
fn check_is_commit_sha(input: &str) -> bool {
448455
input.len() == 40
449456
&& input
@@ -459,6 +466,7 @@ fn url_to_file_name(url: &str) -> String {
459466
.to_string()
460467
}
461468

469+
// TODO: add more tests
462470
#[cfg(test)]
463471
mod tests {
464472
use super::*;

external-crates/move/crates/move-package-alt/src/jsonrpc/client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct Endpoint<I: AsyncRead, O: AsyncWrite> {
1818
sqn: RequestID,
1919
}
2020

21+
// TODO: think if we keep errors here or move them in their own error module
2122
#[derive(Error, Debug)]
2223
pub enum JsonRpcError {
2324
#[error(transparent)]

external-crates/move/crates/move-package-alt/src/package/manifest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::{
1919

2020
use super::*;
2121

22+
// TODO: add 2025 edition
2223
const ALLOWED_EDITIONS: &[&str] = &["2024", "2024.beta", "legacy"];
2324

2425
// Note: [Manifest] objects are immutable and should not implement [serde::Serialize]; any tool
@@ -94,6 +95,8 @@ impl<F: MoveFlavor> Manifest<F> {
9495
}
9596

9697
/// Validate the manifest contents, after deserialization.
98+
///
99+
// TODO: add more validation
97100
pub fn validate_manifest(&self, handle: FileHandle) -> PackageResult<()> {
98101
// Validate package name
99102
if self.package.name.get_ref().is_empty() {

0 commit comments

Comments
 (0)