Add tagref source code annotations

Source Code Annotation Tags:

Global tags (in tagref format <https://github.com/stepchowfun/tagref>)
for source code annotation:

- [tag:hardcoded_color_value] Replace hardcoded color values with user
   configurable ones.
- [tag:needs_unit_test]
- [tag:needs_user_doc]
- [tag:needs_dev_doc]
- [tag:FIXME]
- [tag:TODO]
- [tag:VERIFY] Verify whether this is the correct way to do something
- [tag:DEBT] Technical debt
async-cursors
Manos Pitsidianakis 2023-07-13 16:47:11 +03:00
parent a5770c89f4
commit d4e605c098
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
39 changed files with 90 additions and 63 deletions

View File

@ -21,6 +21,7 @@
CARGO_TARGET_DIR ?= target
MIN_RUSTC ?= 1.65.0
CARGO_BIN ?= cargo
TAGREF_BIN ?= tagref
CARGO_ARGS ?=
CARGO_SORT_BIN = cargo-sort
PRINTF = /usr/bin/printf
@ -94,7 +95,7 @@ help:
@#@echo "* CARGO_COLOR = ${CARGO_COLOR}"
.PHONY: check
check:
check: check-tagrefs
@${CARGO_BIN} check ${CARGO_ARGS} ${CARGO_COLOR}--target-dir="${CARGO_TARGET_DIR}" ${FEATURES} --all --tests --examples --benches --bins
.PHONY: fmt
@ -185,3 +186,13 @@ deb-dist:
.PHONY: build-rustdoc
build-rustdoc:
@RUSTDOCFLAGS="--crate-version ${VERSION}_${GIT_COMMIT}_${DATE}" ${CARGO_BIN} doc ${CARGO_ARGS} ${CARGO_COLOR}--target-dir="${CARGO_TARGET_DIR}" --all-features --no-deps --workspace --document-private-items --open
.PHONY: check-tagrefs
check-tagrefs:
@(if ! command -v "$(TAGREF_BIN)" > /dev/null;\
then \
$(PRINTF) "Warning: tagref binary not in PATH.\n" 1>&2;\
exit;\
else \
$(TAGREF_BIN);\
fi)

View File

@ -717,7 +717,7 @@ for PGP configuration.
.It Cm save-draft
saves a copy of the draft in the Draft folder
.El
.\" TODO add contacts section
.\" [ref:TODO]: add contacts section
.Sh THEMES
See
.Xr meli-themes 5

View File

@ -31,7 +31,7 @@ use smallvec::SmallVec;
use super::*;
use crate::{conf::accounts::JobRequest, types::segment_tree::SegmentTree};
// TODO: emoji_text_presentation_selector should be printed along with the chars
// [ref:TODO]: emoji_text_presentation_selector should be printed along with the chars
// before it but not as a separate Cell
//macro_rules! emoji_text_presentation_selector {
// () => {
@ -55,7 +55,7 @@ pub const DEFAULT_SNOOZED_FLAG: &str = "💤";
pub struct RowsState<T> {
pub selection: HashMap<EnvelopeHash, bool>,
pub row_updates: SmallVec<[EnvelopeHash; 8]>,
/// FIXME: env vec should have at least one element guaranteed
/// [ref:FIXME]: env vec should have at least one element guaranteed
pub thread_to_env: HashMap<ThreadHash, SmallVec<[EnvelopeHash; 8]>>,
pub env_to_thread: HashMap<EnvelopeHash, ThreadHash>,
pub thread_order: HashMap<ThreadHash, usize>,

View File

@ -589,7 +589,7 @@ impl ListingTrait for CompactListing {
.get_thread_under_cursor(self.cursor_pos.2 + 1)
.is_some()
{
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Down(1));
self.force_draw = true;
self.dirty = true;
@ -609,7 +609,7 @@ impl ListingTrait for CompactListing {
.get_thread_under_cursor(self.cursor_pos.2 - 1)
.is_some()
{
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Up(1));
self.force_draw = true;
self.dirty = true;
@ -1848,7 +1848,7 @@ impl Component for CompactListing {
self.sort = (*field, *order);
self.sortcmd = true;
if !self.filtered_selection.is_empty() {
// FIXME: perform sort
// [ref:FIXME]: perform sort
self.set_dirty(true);
} else {
self.refresh_mailbox(context, false);
@ -1857,10 +1857,11 @@ impl Component for CompactListing {
}
Action::SubSort(field, order) if !self.unfocused() => {
self.subsort = (*field, *order);
// FIXME: perform subsort.
// [ref:FIXME]: perform subsort.
return true;
}
Action::Listing(ToggleThreadSnooze) if !self.unfocused() => {
// [ref:FIXME]: Re-implement toggle thread snooze
/*
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
let account = &mut context.accounts[&self.cursor_pos.0];

View File

@ -402,7 +402,7 @@ impl ListingTrait for ConversationsListing {
.get_thread_under_cursor(self.cursor_pos.2 + 1)
.is_some()
{
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Down(1));
self.force_draw = true;
self.dirty = true;
@ -422,7 +422,7 @@ impl ListingTrait for ConversationsListing {
.get_thread_under_cursor(self.cursor_pos.2 - 1)
.is_some()
{
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Up(1));
self.force_draw = true;
self.dirty = true;

View File

@ -319,7 +319,7 @@ impl ListingTrait for PlainListing {
fn next_entry(&mut self, context: &mut Context) {
if self.get_env_under_cursor(self.cursor_pos.2 + 1).is_some() {
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Down(1));
self.force_draw = true;
self.dirty = true;
@ -336,7 +336,7 @@ impl ListingTrait for PlainListing {
return;
}
if self.get_env_under_cursor(self.cursor_pos.2 - 1).is_some() {
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Up(1));
self.force_draw = true;
self.dirty = true;

View File

@ -435,7 +435,7 @@ impl ListingTrait for ThreadListing {
fn next_entry(&mut self, context: &mut Context) {
if self.get_env_under_cursor(self.cursor_pos.2 + 1).is_some() {
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Down(1));
self.force_draw = true;
self.dirty = true;
@ -450,7 +450,7 @@ impl ListingTrait for ThreadListing {
return;
}
if self.get_env_under_cursor(self.cursor_pos.2 - 1).is_some() {
// TODO: makes this less ugly.
// [ref:TODO]: makes this less ugly.
self.movement = Some(PageMovement::Up(1));
self.force_draw = true;
self.dirty = true;
@ -757,7 +757,6 @@ impl ThreadListing {
fn highlight_line_self(&mut self, _idx: usize, _context: &Context) {
/*
* FIXME
if self.length == 0 {
return;
}

View File

@ -653,7 +653,7 @@ impl Component for MailView {
/* autosend or open unsubscribe option */
let unsubscribe = actions.unsubscribe.as_ref().unwrap();
for option in unsubscribe.iter() {
/* TODO: Ask for confirmation before proceding with an action */
/* [ref:TODO]: Ask for confirmation before proceding with an action */
match option {
list_management::ListAction::Email(email) => {
if let Ok(mailto) = Mailto::try_from(*email) {

View File

@ -152,7 +152,7 @@ impl EnvelopeView {
err.to_string(),
Some(NotificationType::Error(melib::ErrorKind::External)),
)));
// FIXME: add `v` configurable shortcut
// [ref:FIXME]: add `v` configurable shortcut
let comment = Some(format!(
"Failed to start html filter process: `{}`. Press `v` to open in web \
browser. \n\n",
@ -166,7 +166,7 @@ impl EnvelopeView {
});
}
Ok(text) => {
// FIXME: add `v` configurable shortcut
// [ref:FIXME]: add `v` configurable shortcut
let comment = Some(format!(
"Text piped through `{}`. Press `v` to open in web browser. \n\n",
filter_invocation

View File

@ -941,7 +941,7 @@ impl ThreadView {
&& stack.len() > 1
&& stack[stack.len() - 2] >= e.indentation =>
{
//FIXME pop all until e.indentation
// [ref:FIXME]: pop all until e.indentation
visies.push(vec![idx]);
stack.pop();
(visies, stack, e.hidden)

View File

@ -126,7 +126,7 @@ pub struct VSplit {
impl fmt::Display for VSplit {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// TODO display focused component
// [ref:TODO]: display focused component
Display::fmt(&self.right, f)
}
}

View File

@ -300,7 +300,7 @@ impl Component for TextField {
/* Ctrl+E End of line */
self.inner.set_cursor(self.inner.as_str().len());
}
/* TODO: add rest of readline shortcuts */
/* [ref:TODO]: add rest of readline shortcuts */
_ => {
return false;
}

View File

@ -863,7 +863,7 @@ impl AutoComplete {
return false;
}
// FIXME: remove hardcoded color values
// [ref:hardcoded_color_value]
let mut content = CellBuffer::new(
entries
.iter()

View File

@ -2102,7 +2102,7 @@ impl Account {
&self.mailbox_entries,
&mut self.mailboxes_order,
);
// FIXME remove from settings as well
// [ref:FIXME] remove from settings as well
self.main_loop_handler.send(ThreadEvent::UIEvent(
UIEvent::Notification(
@ -2196,7 +2196,7 @@ impl Account {
if err.kind.is_timeout() {
self.watch();
} else {
//TODO: relaunch watch job with ratelimit for failure
// [ref:TODO]: relaunch watch job with ratelimit for failure
self.main_loop_handler.send(ThreadEvent::UIEvent(
UIEvent::Notification(
Some(format!("{}: watch thread failed", &self.name)),

View File

@ -155,7 +155,7 @@ impl MailcapEntry {
let mut f = None;
let mut needs_stdin = true;
let params = a.parameters();
/* TODO: See mailcap(5)
/* [ref:TODO]: See mailcap(5)
* - replace "\%" with "%" and unescape other blackslash uses.
* - "%n" and "%F".
* - test=xxx field.

View File

@ -956,8 +956,9 @@ impl MailBackend for ImapType {
}
}
/* FIXME Do not try to CREATE a sub-mailbox in a mailbox
* that has the \Noinferiors flag set. */
/* [ref:FIXME] Do not try to CREATE a sub-mailbox in a
* mailbox that has the \Noinferiors flag
* set. */
}
let mut response = Vec::with_capacity(8 * 1024);
@ -1403,7 +1404,7 @@ impl ImapType {
.iter()
.any(|cap| cap.eq_ignore_ascii_case(b"LIST-STATUS"));
if has_list_status {
// TODO(#222): imap-codec does not support "LIST Command Extensions" currently.
// [ref:TODO]: (#222) imap-codec does not support "LIST Command Extensions" currently.
conn.send_command_raw(b"LIST \"\" \"*\" RETURN (STATUS (MESSAGES UNSEEN))")
.await?;
conn.read_response(

View File

@ -423,7 +423,7 @@ impl ImapConnection {
// "SEARCH MODSEQ <cached-value>".
// 2. tag1 UID FETCH <lastseenuid+1>:* <descriptors>
// TODO(#222): imap-codec does not support "CONDSTORE/QRESYNC" currently.
// [ref:TODO]: (#222) imap-codec does not support "CONDSTORE/QRESYNC" currently.
self.send_command_raw(
format!(
"UID FETCH {}:* (UID FLAGS ENVELOPE BODY.PEEK[HEADER.FIELDS (REFERENCES)] \
@ -519,7 +519,7 @@ impl ImapConnection {
mailbox_exists.lock().unwrap().insert_set(payload_hash_set);
// 3. tag2 UID FETCH 1:<lastseenuid> FLAGS
if cached_max_uid == 0 {
// TODO(#222): imap-codec does not support "CONDSTORE/QRESYNC" currently.
// [ref:TODO]: (#222) imap-codec does not support "CONDSTORE/QRESYNC" currently.
self.send_command_raw(
format!(
"UID FETCH 1:* FLAGS (CHANGEDSINCE {})",
@ -529,7 +529,7 @@ impl ImapConnection {
)
.await?;
} else {
// TODO(#222): imap-codec does not support "CONDSTORE/QRESYNC" currently.
// [ref:TODO]: (#222) imap-codec does not support "CONDSTORE/QRESYNC" currently.
self.send_command_raw(
format!(
"UID FETCH 1:{} FLAGS (CHANGEDSINCE {})",

View File

@ -247,7 +247,7 @@ impl ImapStream {
}
{
// FIXME: This is blocking
// [ref:FIXME]: This is blocking
let socket = socket.into_inner()?;
let mut conn_result = connector.connect(path, socket);
if let Err(native_tls::HandshakeError::WouldBlock(midhandshake_stream)) =

View File

@ -152,7 +152,7 @@ impl BackendOp for ImapOp {
if v.len() != 1 {
debug!("responses len is {}", v.len());
debug!(String::from_utf8_lossy(&response));
/* TODO: Trigger cache invalidation here. */
/* [ref:TODO]: Trigger cache invalidation here. */
debug!("message with UID {} was not found", uid);
return Err(
Error::new(format!("Invalid/unexpected response: {:?}", response))

View File

@ -48,7 +48,7 @@ pub async fn poll_with_examine(kit: ImapWatchKit) -> Result<()> {
for (_, mailbox) in mailboxes.clone() {
examine_updates(mailbox, &mut conn, &uid_store).await?;
}
//FIXME: make sleep duration configurable
//[ref:FIXME]: make sleep duration configurable
smol::Timer::after(std::time::Duration::from_secs(3 * 60)).await;
}
}
@ -261,7 +261,7 @@ pub async fn examine_updates(
.iter()
.any(|cap| cap.eq_ignore_ascii_case(b"LIST-STATUS"));
if has_list_status {
// TODO(#222): imap-codec does not support "LIST Command Extensions" currently.
// [ref:TODO]: (#222) imap-codec does not support "LIST Command Extensions" currently.
conn.send_command_raw(
format!(
"LIST \"{}\" \"\" RETURN (STATUS (MESSAGES UNSEEN))",

View File

@ -743,7 +743,7 @@ impl MailBackend for JmapType {
Flag::REPLIED => "$answered",
Flag::TRASHED => "$junk",
Flag::PASSED => "$passed",
_ => continue, //FIXME
_ => continue, // [ref:VERIFY]
}
),
if *value {

View File

@ -368,7 +368,7 @@ impl JmapConnection {
index: _,
} in added
{
// FIXME
// [ref:TODO] do something with added items
}
}
Ok(_) => {}

View File

@ -101,7 +101,7 @@ impl BackendMailbox for JmapMailbox {
fn set_is_subscribed(&mut self, new_val: bool) -> Result<()> {
self.is_subscribed = new_val;
// FIXME: jmap subscribe
// [ref:FIXME]: jmap subscribe
Ok(())
}

View File

@ -655,7 +655,7 @@ impl From<crate::search::Query> for Filter<EmailFilterCondition, EmailObject> {
);
}
AllAddresses(_) => {
//TODO
// [ref:TODO]: implement AllAddresses query for jmap
}
Flags(v) => {
fn flag_to_filter(f: &str) -> Filter<EmailFilterCondition, EmailObject> {
@ -736,16 +736,16 @@ impl From<crate::search::Query> for Filter<EmailFilterCondition, EmailObject> {
*f = !qhs;
}
Answered => {
// TODO
// [ref:TODO]: implement Answered query for jmap
}
AnsweredBy { .. } => {
// TODO
// [ref:TODO]: implement AnsweredBy query for jmap
}
Larger { .. } => {
// TODO
// [ref:TODO]: implement Larger than query for jmap
}
Smaller { .. } => {
// TODO
// [ref:TODO]: implement Smaller than query for jmap
}
}
}

View File

@ -27,7 +27,7 @@ pub struct Comparator<OBJ: Object> {
property: String,
#[serde(default = "bool_true")]
is_ascending: bool,
//FIXME
// [ref:TODO] implement collations
collation: Option<String>,
//#[serde(flatten)]
additional_properties: Vec<String>,

View File

@ -841,7 +841,7 @@ impl FetchState {
let new_low = std::cmp::max(low, high.saturating_sub(CHUNK_SIZE));
high_low_total.as_mut().unwrap().0 = new_low;
// FIXME: server might not implement OVER capability
// [ref:FIXME]: server might not implement OVER capability
conn.send_command(format!("OVER {}-{}", new_low, high).as_bytes())
.await?;
conn.read_response(&mut res, true, command_to_replycodes("OVER"))

View File

@ -146,7 +146,7 @@ impl NntpStream {
}
{
// FIXME: This is blocking
// [ref:FIXME]: This is blocking
let socket = ret.stream.into_inner()?;
let mut conn_result = connector.connect(path, socket);
if let Err(native_tls::HandshakeError::WouldBlock(midhandshake_stream)) =

View File

@ -792,7 +792,7 @@ impl MailBackend for NotmuchDb {
_mailbox_hash: MailboxHash,
flags: Option<Flag>,
) -> ResultFuture<()> {
// FIXME call notmuch_database_index_file ?
// [ref:FIXME]: call notmuch_database_index_file ?
let path = self
.save_messages_to
.as_ref()

View File

@ -127,7 +127,7 @@ use crate::{
};
#[cfg(feature = "imap_backend")]
// TODO(#222): Make this `const` as soon as it is possible.
// [ref:TODO]: (#222) Make this `const` as soon as it is possible.
pub(crate) fn common_attributes() -> MacroOrMessageDataItemNames<'static> {
MacroOrMessageDataItemNames::MessageDataItemNames(vec![
MessageDataItemName::Uid,
@ -675,7 +675,7 @@ impl Envelope {
}
pub fn set_in_reply_to(&mut self, new_val: &[u8]) -> &mut Self {
// FIXME msg_id_list
// [ref:FIXME]: msg_id_list
let new_val = new_val.trim();
if !new_val.is_empty() {
let val = match parser::address::msg_id(new_val) {

View File

@ -672,7 +672,7 @@ impl Attachment {
..
} => {
ret.push(att.clone());
// FIXME: Wrong count
// [ref:FIXME]: Wrong count
for a in sub_att_vec {
count_recursive(a, ret);
}

View File

@ -201,7 +201,7 @@ impl Draft {
ret.headers_mut()
.insert(HeaderName::TO, envelope.field_from_to_string());
}
// FIXME: add To/Cc
// [ref:FIXME]: add To/Cc
} else if let Some(reply_to) = envelope.other_headers().get("Mail-Reply-To") {
ret.headers_mut()
.insert(HeaderName::TO, reply_to.to_string());

View File

@ -83,7 +83,7 @@ pub fn encode_header(value: &str) -> String {
}
#[cfg(not(feature = "unicode_algorithms"))]
{
/* TODO: test this. If it works as fine as the one above, there's no need to
/* [ref:VERIFY] [ref:TODO]: test this. If it works as fine as the one above, there's no need to
* keep the above implementation. */
for (i, g) in value.char_indices() {
match (g.is_ascii(), is_current_window_ascii) {

View File

@ -373,7 +373,7 @@ mod tests {
// 'mailto' URI:
// <mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org>.
// [tag:FIXME]
// [ref:FIXME]
//assert_eq!(
// mlt!("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org").
// address, vec![addr!(r#"\"it's ugly\"@example.org"#)]
@ -399,7 +399,6 @@ mod tests {
// The same subject, this time using an encoded-word (escaping the "="
// and "?" characters used in the encoded-word syntax, because they are
// reserved):
// [tag:FIXME]
// <mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D>
assert_eq!(
&mlt!("mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D").headers
@ -410,7 +409,6 @@ mod tests {
// The same subject, this time encoded as iso-8859-1:
// <mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D>
// [tag:FIXME]
assert_eq!(
&mlt!("mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D").headers
[HDR::SUBJECT],

View File

@ -2800,7 +2800,7 @@ mod tests {
);
}
// //FIXME: add file
// // [ref:FIXME]: add file
//#[test]
//fn test_attachments() {
// use std::io::Read;

View File

@ -19,6 +19,9 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
// [ref:DEBT] segfaults on libgpgme code can crash the entire app; it should be
// handled.
use std::{
borrow::Cow,
collections::HashMap,

View File

@ -53,6 +53,20 @@
clippy::significant_drop_in_scrutinee,
clippy::cognitive_complexity
)]
/* Source Code Annotation Tags:
*
* Global tags (in tagref format <https://github.com/stepchowfun/tagref>) for source code
* annotation:
*
* - [tag:hardcoded_color_value] Replace hardcoded color values with user configurable ones.
* - [tag:needs_unit_test]
* - [tag:needs_user_doc]
* - [tag:needs_dev_doc]
* - [tag:FIXME]
* - [tag:TODO]
* - [tag:VERIFY] Verify whether this is the correct way to do something
* - [tag:DEBT] Technical debt
*/
//! A crate that performs mail client operations such as
//! - Hold an [`Envelope`](./email/struct.Envelope.html) with methods convenient

View File

@ -217,7 +217,7 @@ impl<'a> Iterator for LineBreakCandidateIter<'a> {
* NS SJ Any
*/
// TODO: LB1
// [ref:TODO]: LB1
/* Check if next character class allows breaks before it */
let mut next_char: Option<&(usize, &str)> = iter.peek();

View File

@ -343,7 +343,7 @@ impl SubjectPrefix for &[u8] {
continue;
}
if slice.starts_with(b" ") || slice.starts_with(b"\t") || slice.starts_with(b"\r") {
//FIXME just trim whitespace
// [ref:FIXME]: just trim whitespace
slice = &slice[b" ".len()..];
continue;
}
@ -418,7 +418,7 @@ impl SubjectPrefix for &str {
continue;
}
if slice.starts_with(' ') || slice.starts_with('\t') || slice.starts_with('\r') {
//FIXME just trim whitespace
// [ref:FIXME]: just trim whitespace
slice = &slice[1..];
continue;
}
@ -1155,7 +1155,7 @@ impl Threads {
}
fn inner_subsort_by(&self, _subsort: (SortField, SortOrder), _envelopes: &Envelopes) {
//FIXME: self\.thread_nodes needs interior mutability */
// [ref:FIXME]: self\.thread_nodes needs interior mutability */
/*
let Threads {
ref tree_index,
@ -1499,7 +1499,7 @@ impl Threads {
}
pub fn roots(&self) -> SmallVec<[ThreadHash; 1024]> {
//FIXME: refactor filter
// [ref:FIXME]: refactor filter
self.groups
.iter()
.filter_map(|(h, g)| g.root().map(|_| *h))

View File

@ -82,7 +82,7 @@ impl Connection {
#[cfg(feature = "tls")]
Tls(ref t) => t.get_ref().set_nonblocking(nonblocking),
Fd(fd) => {
//FIXME TODO Review
// [ref:VERIFY]
nix::fcntl::fcntl(
*fd,
nix::fcntl::FcntlArg::F_SETFL(if nonblocking {
@ -146,7 +146,7 @@ impl Connection {
keepalive.is_some() as c_int,
)?;
if let Some(dur) = keepalive {
// TODO: checked cast here
// [ref:TODO]: checked cast here
self.setsockopt(libc::IPPROTO_TCP, KEEPALIVE_OPTION, dur.as_secs() as c_int)?;
}
Ok(())