Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

XML doc comments coverage (edits & additions) #682

Merged

Conversation

Ste1io
Copy link
Collaborator

@Ste1io Ste1io commented Jun 23, 2023

A couple notes regarding the changes on this branch:

  • All multi-line comment sections (<section>...</section>, <remarks>...</remarks>, etc) have been combined into single lines.
  • Indented comments had the preceeding spaces removed (/// foobar => /// foobar).
  • The order of some xml doc comment blocks were rearranged based on the following ordering rules:
    <!-- methods -->
    <section/>
    <remarks/>
    <typeparam/>
    <param/>
    <returns/>
    <exception/>
    
    <!-- properties -->
    <section/>
    <remarks/>
    <value/> <!-- used instead of "returns" tag -->

The above changes were to enable me to more easily parse through the existing comments to identify and fix any spelling errors or needed modifications. Also, it should make reviewing the diffs less cumbersome. Not to mention editing or writing comments while maintaining the appropriate line breaks is a pain in the @$$. :) Easier to just reapply the formatting when everything is ready for merging.

While my intention was to just add the missing doc comments causing the compiler warnings, it made more sense for me to do a full thorough review while I was at it. Ensuring consistency across the board will make implementing a static documentation site for GitHub pages (using docfx or something similar) that's generated from the code sooo much easier, if we choose to do that (imo, it would be a good idea). Most importantly, though, it's been very beneficial for me personally catching up with the changes to the library since the single-file days, which is helping shape out the direction for some of the new documentation tremendously.

Apologies in advance for such a huge amount of code for you guys to look over. I plan on squashing the commits when it's ready for merging, but leaving them as is in the meantime so that reviewing related changes between two consecutive commits is possible. Most of the changes in the first commit will evaporate with the final commit, but actual changes made to the existing comments I felt should be easily reviewed without formatting changes or additions crowding up the diffs.

.editorconfig Outdated Show resolved Hide resolved
@Ste1io Ste1io self-assigned this Jun 23, 2023
PetaPoco/EventArgs.cs Outdated Show resolved Hide resolved
PetaPoco/OracleProvider.cs Outdated Show resolved Hide resolved
@Ste1io Ste1io force-pushed the docs-xml-comments-coverage branch from e6acf88 to 1dbf26c Compare June 25, 2023 11:24
@pleb
Copy link
Member

pleb commented Jun 26, 2023

@Ste1io thanks for fixing this up :)

@Ste1io
Copy link
Collaborator Author

Ste1io commented Jun 28, 2023

Morning gents, wrapping up the remaining xml doc comments for all things async before the weekend. Do you want the leading spaces for summary and remarks sections added back in, or left as is? Also, what's the magic number for the column breaks?

@pleb
Copy link
Member

pleb commented Jul 4, 2023

@Ste1io I don't mind regarding leading space or not, so long as it's consistent. Regarding doc comments length, pick something that works for you but isn't too constrained for everyone... maybe something between 80 - 160 etc

@Ste1io
Copy link
Collaborator Author

Ste1io commented Jul 7, 2023

@pleb will do. Plan on wrapping this PR up over the weekend or early next week. What do you want me to do about the changes to the doc tests?

@Ste1io
Copy link
Collaborator Author

Ste1io commented Jul 27, 2023

Aside from some minor fix-ups and any additional changes following code review, xml doc comments are finished. So as not to contribute to the loss of your sanity, I batched all relocated code into two commits, so the actual changes can be easily diffed without making your eyes bleed. Expect these commits to get pushed to remote shortly.

@Ste1io Ste1io force-pushed the docs-xml-comments-coverage branch from ac80468 to 4685158 Compare July 27, 2023 15:30
Copy link
Collaborator Author

@Ste1io Ste1io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e294f5b is the best commit to compare diffs for additional changes after this point, as everything is a line-for-line match.

https://github.com/CollaboratingPlatypus/PetaPoco/pull/682/files/e294f5bb06812d28ea90c6f96e59f44cec010fc3..5cd6bdbf208ede225dce461d44666bf6d9240092

@Ste1io
Copy link
Collaborator Author

Ste1io commented Jul 27, 2023

I've got a dozen or so issues that surfaced while doing the doc comments. They all need to be addressed, but they aren't related to my changes. I started adding them in this thread, but as some of them are breaking changes (changes with interface contracts, as one example), I'd rather avoid holding up this PR until a major release because preexisting issues are associated with it.

Any preference with how I go about them? Bulk them up in a couple of issues, or an issue for each? They're all fairly easy to fix, and I'll be happy to front the grunt work with fixing them (I have a local branch with many of the fixes already implemented, as it stands), but pushing to a release build would require a major version bump.

For context, here's a portion of the todo comment dump so you know what I'm referring to (objective observations only; opinionated ideas are omitted for another discussion on another day :)):

21 results - 7 files

PetaPoco\Database.cs:
   579:         // TODO: [BREAKING] Not in IDatabase interface: `OnException(Exception)`, to allow GridReader's DI impl to accept IDatabase (IAsyncReader is able to correctly use the interface for it's IOC because it doesn't require the OnException))
   895:         // TODO: [BUGFIX] `QueryAsync(CancellationToken, string, object[])` takes a caller-provided CancellationToken, but uses a default empty token for wrapped call
   949:         // TODO: [BUGFIX] `QueryAsync(Action<T>, CancellationToken, string, object[])` takes a caller-provided CancellationToken, but uses a default empty token for wrapped call
  1340:         // TODO: [BUGFIX] `FetchAsync(CancellationToken, string, object[])` takes a caller-provided CancellationToken, but uses a default empty token for wrapped call
  1622:         // TODO: [BUGFIX] `SkipTakeAsync(long, long, Sql)` should forward call to an overload that receives a CancellationToken
  3220:         // TODO: [BUGFIX] `CommandHelperAsync(CancellationToken, DbCommand, Func<CancellationToken, DbCommand, Task<object>>` takes DBCommand type; inconsistent with synchronous version `CommandHelper(IDbCommand, Func<IDbCommand, object>)` which correctly uses IDbCommand type

PetaPoco\IAsyncReader.cs:
  23:         // TODO: [BREAKING] Missing overload: `Task<bool> ReadAsync(CancellationToken)`

PetaPoco\IConnection.cs:
  42:         // TODO: [BREAKING] Missing overload: `Task OpenSharedConnectionAsync(CancellationToken)`

PetaPoco\IDatabase.cs:
  105:         // TODO: [BREAKING] Missing: `AbortTransactionAsync()`
  115:         // TODO: [BREAKING] Missing: `CompleteTransactionAsync()`
  141:         // TODO: [BREAKING] Missing: `event EventHandler<DbConnectionEventArgs> ConnectionOpening`

PetaPoco\IQuery.cs:
  472:         // TODO: [BREAKING] Missing overload: `bool IQuery.Exists<T>(Sql);`

PetaPoco\IQueryAsync.cs:
  478:         // TODO: [BREAKING] Missing overload: `IQueryAsync.ExistsAsync<T>(Sql);`
  495:         // TODO: [BREAKING] Missing overload: `IQueryAsync.ExistsAsync<T>(CancellationToken, Sql);`

PetaPoco\Utilities\AsyncReader.cs:
  62:         // TODO: [BREAKING] Not implemented: `ReadAsync(CancellationToken)`

For future reference, line references above correspond with 5cd6bdb.

There's also a heap of "not broken but worth discussing" notes that would all fit into at least a partial refactor (v7?!?), which I've omitted here, as they should probably best be proposed with a discussion so everything is somewhat coherent.

[edit] Not sure what I was thinking earlier, but passing in a cancellation token for abort/close/cleanup isn't going to be very productive. 🤦🏻‍♂️ Removed those from the dump above.

@Ste1io Ste1io marked this pull request as ready for review July 30, 2023 03:05
@Ste1io
Copy link
Collaborator Author

Ste1io commented Aug 7, 2023

After @asherber is finished looking over anything and any changes following are sorted, I'll update this branch with the text wrap and we should be all set. You want me to squash down these commits on that final commit, or leave them as is and let you handle that how you want when you merge in the PR?

@Ste1io Ste1io requested a review from pleb August 17, 2023 07:42
@Ste1io
Copy link
Collaborator Author

Ste1io commented Aug 17, 2023

@pleb and @asherber I made one final commit that fixes some terminology and unifies the doc comments for matching params across the code base. The only change left is to rewrap the doc comments blocks; I'm holding off on that until I get a confirmation that this PR is ready to merge in since comparing diffs trends to be easier without.

@pleb
Copy link
Member

pleb commented Aug 18, 2023

All good, @Ste1io. If the tests are passing, I say it's good to go

@Ste1io
Copy link
Collaborator Author

Ste1io commented Aug 19, 2023

All good, @Ste1io. If the tests are passing, I say it's good to go

All Sqlite tests pass. I need to get my docker setup sorted before I can test the others, but will advise as soon as that's done.

@Ste1io
Copy link
Collaborator Author

Ste1io commented Sep 7, 2023

Finally got around to restarting my pc (a rare occurrence) and reconfiguring virtualization in BIOS again since replacing my mobo and processor earlier this year, so I'm good to go with docker once more.

Which brings me to my question... How long has it been since the full test suite has been run for all dbms?

@Ste1io Ste1io force-pushed the docs-xml-comments-coverage branch from a0c05df to f6cc66f Compare September 29, 2023 21:55
- remove leading/trailing whitespace
- merge multiline sections into single line

fix typos, spelling, grammar, inline tag usage:
- add closing punctuation for all doc comments
- correct grammar, spelling, sentence structure
- consistently aussie-ise inflection classes
- replace inline "seealso" tags with "see" tags (seealso is toplevel)
- use inheritdoc where appropriate
- populate present but empty doc comment tags

Create .editorconfig generated from current styles

update existing comments for consistency
- use "langword=" for null|true|false
- use <value> for properties, <returns> for methods
- use "Gets..."|"Gets or sets..." verbiage for property summaries
- use "Returns..." verbiage for method summaries
- split lengthy summaries into <remarks> section
- use <example><code> sections
- consistent section order (<remarks> second, <exception> at end)
- add a few sparse missing sections

add xml doc comments

associated code changes:
AnsiStringExtensions.cs
- cleanup: removed unused usings
PagingHelper.cs
- public Regex fields converted to cached properties with get accessors (.NET framework guidelines discourage publicly visible fields)
ColumnAttribute.cs
- ForceToUtc moved below ForceToDateTime2
ValueConverterAttribute.cs
- ConvertToDb moved below ConvertFromDb (order used in IMapper, ConventionMapper, StandardMapper)

add xml doc comments for db providers
- fix typo from previous commit, reverting "@param" change
- reverted some renamed params (mainly "cmd") since inheritdoc can be picky if inheritance tree param names aren't identical
- moved a couple definitions for ExecuteInsertAsync to below their synchronous counterpart

add xml doc comments for IAsyncReader/AsyncReader

PocoColumn, ColumnInfo prep
- update order of properties for consistency
- make public fields properties with get, set methods

add xml doc comments for column related classes

improve xml doc comments for Inflector
- readability - use inheritdoc for EnglishEnflector class
- add commonly used casing name and short example to summary/remarks
- what? no RUDERISE method?!?

misc xml doc comment fixes
- typos (?param, not @param)
- add missing exceptions
- disable warning 1998 (Async method lacks 'await' operators) for conditionally-compiled CleanupTransactionAsync method
- change inheritdoc strat for IGridReader, removing need to disable warning 1712
- remove unused usings

add xml doc comments for IExecute/Async, IStoredProc/Async

add region scopes to IAlterPoco/Async, IQuery/Async

fix tests:
- comment typo corrections
- remove unneeded truncate calls for doc tests
…s of related methods and overloads.

no code changes present in this commit; only code locality changes and region scope naming.
@Ste1io Ste1io force-pushed the docs-xml-comments-coverage branch from f6cc66f to 24dedd0 Compare September 30, 2023 01:58
- Database.cs
- ColumnInfo.cs
- IGridReader.cs
- PocoData.cs
- AsyncReader.cs
- DatabaseConfigurationExtensions.cs
- Interfaces (db operations)
- Attribute classes

add missing `#if ASYNC` scopes, fix disparite usage of `!NET40` to wrap async methods:
- IAlterPocoAsync.cs
- IConnection.cs
- IStoredProcAsync.cs

renamed parameter names for variables and callback methods:
- DatabaseConfigurationExtensions.cs
  `configure`->`cofigurer`
- IGridReader.cs
  `func`->`projector`
- IQuery.cs
  `cb`->`projector`
  `itemsPerPage`->`maxItemsPerPage`
  `sqlCount`->`countSql` (match countArgs format)
  `sqlPage`->`pageSql` (match pageArgs format)
  `primaryKey`->`pocoOrPrimaryKey` (selective for specific context...eg `Exists`, `ExistsAsync`)
- IQueryAsync.cs
  `receivePocoCallback`->`action`
  `itemsPerPage`->`maxItemsPerPage`
  `sqlCount`->`countSql` (match countArgs format)
  `sqlPage`->`pageSql` (match pageArgs format)
- IStoredProcAsync.cs
  `receivePocoCallback`->`action`
- ParametersHelper.cs
  `args_src`->`srcArgs` (consistent naming convention for public visible parameters)
  `args_dest`->`destArgs` (consistent naming convention for public visible parameters)

renamed type names:
- DatabaseConfigurationExtensions.cs
  `T`->`TProvider`
  `T`->`TMapper`
- IGridReader.cs
  `TRet`->`TResult`
- IQuery.cs
  `TRet`->`TResult`
- IQueryAsync.cs

other notable changes
- bugs: see todo comments
- Page{T}, IQuery, IQueryAsync: switch from "itemsPerPage" to "maxItemsPerPage"

add todos

consistent wording touchups:
- <typeparam>
- <param name="cancellationToken">
- <returns> (async)

fix indentation differences (tabs vs. spaces)

add remarks about primary key during insert op when executed from Save/SaveAsync methods

consistency changes in wording

fix Single/SingleAsync, SingleOrDefault/SingleOrDefaultAsync comments

consistent use of primaryKey for pk value, vs primaryKeyName for column name

tightened up some of the terminology referencing specific sql statement parts (eg consistent use of dbms' terms such as clauses, conjunctions, commands vs queries, etc)

consistent inline null tags

param doc strings improvements, consistent wording

param name change for clarity:
- ColumnAttribute.cs, ResultColumnAttribute.cs:
  name->column
- Database.cs
  conn->connection
  pd->pocoData
  pc->pocoColumn
- DatabaseConfiguration.cs
  setSetting->getSetting
  onFail->onFailAction
- IBuildConfigurationSettings.cs
  getSetting->onGetAction
  onFail->onFailAction
- IQueryAsync.cs
  sqlCondition->sql
- ParametersHelper.cs
  setParameterProperties->setPropertiesAction
  paramPrefix->replacementPrefix
  input->value
- PocoData
  countColumns-columnCount

Mappers class: consistent terminology usage (revoke vs remove).

ParametersHelper: move private IsEnumerable method below public methods

Sql class: consistent phrasing and terminology, specify class mutability in class summary

xml cref fixes for SaveAsync doc comments

Final dust off:
- spell check
- minor adjustments in word usage for consistency (auto-select vs AutoSelect, etc)
- completed exception documentation; call forwarding wrappers that do nothing more than wrap a call now document any exceptions thrown by the method they forward to
- add some todos to review with exception handling
- made exception for some exceptions: document exceptions for Single,SingleOrDefault,First,FirstOrDefault (and async versions) in interface, since by nature those methods are contractually required to follow specific exception handling guidelines
consistent spacing before self-closing tags
@Ste1io Ste1io force-pushed the docs-xml-comments-coverage branch from 24dedd0 to bfcdade Compare September 30, 2023 19:20
- resolves todo re inconsistent exception types
- increases test case coverage for possible parameter combinations

there are numerous other methods that need their exception handling changed similarly, in a new PR
@Ste1io
Copy link
Collaborator Author

Ste1io commented Sep 30, 2023

All tests pass. Ready to merge @pleb

1696104597-PetaPoco_-_Microsoft_Visual_Studio

@Ste1io
Copy link
Collaborator Author

Ste1io commented Oct 2, 2023

42crbn

@pleb pleb merged commit 9d4ad94 into CollaboratingPlatypus:development Oct 2, 2023
@Ste1io Ste1io added this to the 6.2 milestone Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants