Repository: mne-tools/mne-bids

Issue:
[MRG] enforce that name be a required file in dataset_description.json
closes #278

Thanks for contributing. If this is your first time,
make sure to read [contributing.md](https://github.com/mne-tools/mne-bids/blob/master/CONTRIBUTING.md)

PR Description
--------------

Describe your PR here

Merge checklist
---------------

Maintainer, please confirm the following before merging:

- [ ] All comments resolved
- [ ] This is not your own PR
- [x] All CIs are happy
- [x] PR title starts with [MRG]
- [x] [whats_new.rst](https://github.com/mne-tools/mne-bids/blob/master/doc/whats_new.rst) is updated
- [x] PR description includes phrase "closes <#issue-number>"
- [x] Commit history does not contain any merge commits


Discussion:
# [Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=h1) Report
> Merging [#279](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=desc) into [master](https://codecov.io/gh/mne-tools/mne-bids/commit/0aff75c0d02a1c84925a7a212659cff1c01d3f29?src=pr&el=desc) will **increase** coverage by `3.23%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/mne-tools/mne-bids/pull/279/graphs/tree.svg?width=650&token=x8vQyTMM9Y&height=150&src=pr)](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #279      +/-   ##
==========================================
+ Coverage   94.59%   97.82%   +3.23%     
==========================================
  Files          11        8       -3     
  Lines        1166      967     -199     
==========================================
- Hits         1103      946     -157     
+ Misses         63       21      -42
```


| [Impacted Files](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [mne\_bids/write.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvd3JpdGUucHk=) | `97.12% <100%> (+0.18%)` | :arrow_up: |
| [mne\_bids/read.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvcmVhZC5weQ==) | `99.16% <0%> (-0.04%)` | :arrow_down: |
| [mne\_bids/utils.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvdXRpbHMucHk=) | `98.32% <0%> (-0.02%)` | :arrow_down: |
| [mne\_bids/copyfiles.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvY29weWZpbGVzLnB5) | `95.57% <0%> (ø)` | :arrow_up: |
| [mne\_bids/commands/mne\_bids\_cp.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvY29tbWFuZHMvbW5lX2JpZHNfY3AucHk=) | | |
| [mne\_bids/commands/mne\_bids\_raw\_to\_bids.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvY29tbWFuZHMvbW5lX2JpZHNfcmF3X3RvX2JpZHMucHk=) | | |
| [mne\_bids/commands/run.py](https://codecov.io/gh/mne-tools/mne-bids/pull/279/diff?src=pr&el=tree#diff-bW5lX2JpZHMvY29tbWFuZHMvcnVuLnB5) | | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=footer). Last update [0aff75c...ff2d471](https://codecov.io/gh/mne-tools/mne-bids/pull/279?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

why were none of our tests failing so far?
it looks as though that function wasn't tested...
should we add a test then? to avoid regression in the future.
@jasmainak the function `make_dataset_description` has no tests. just rebased and address the whats_new. unfortunately i don't have the time to make all the tests for this function. feel free to take it over

Resolving patch:
diff --git a/mne_bids/write.py b/mne_bids/write.py
--- a/mne_bids/write.py
+++ b/mne_bids/write.py
@@ -853,7 +853,7 @@ def make_bids_basename(subject=None, session=None, task=None,
     return filename
 
 
-def make_dataset_description(path, name=None, data_license=None,
+def make_dataset_description(path, name, data_license=None,
                              authors=None, acknowledgements=None,
                              how_to_acknowledge=None, funding=None,
                              references_and_links=None, doi=None,
@@ -868,7 +868,7 @@ def make_dataset_description(path, name=None, data_license=None,
     ----------
     path : str
         A path to a folder where the description will be created.
-    name : str | None
+    name : str
         The name of this BIDS dataset.
     data_license : str | None
         The license under which this datset is published.


Test patch:
diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py
--- a/mne_bids/tests/test_write.py
+++ b/mne_bids/tests/test_write.py
@@ -30,7 +30,7 @@
 from mne.io.kit.kit import get_kit_info
 
 from mne_bids import (write_raw_bids, read_raw_bids, make_bids_basename,
-                      make_bids_folders, write_anat)
+                      make_bids_folders, write_anat, make_dataset_description)
 from mne_bids.write import (_stamp_to_dt, _get_anonymization_daysback,
                             get_anonymization_daysback)
 from mne_bids.tsv_handler import _from_tsv, _to_tsv
@@ -517,6 +517,7 @@ def test_bti(_bids_validate):
     write_raw_bids(raw, bids_basename, bids_root, verbose=True)
 
     assert op.exists(op.join(bids_root, 'participants.tsv'))
+    make_dataset_description(bids_root, name="BTi data")
     _bids_validate(bids_root)
 
     raw = read_raw_bids(bids_basename + '_meg', bids_root)